Changeset e19eb97 for functions.c


Ignore:
Timestamp:
Aug 15, 2009, 7:08:18 PM (15 years ago)
Author:
Anders Kaseorg <andersk@mit.edu>
Branches:
master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
Children:
1077891a
Parents:
fa4562c
git-author:
Anders Kaseorg <andersk@mit.edu> (08/04/09 02:37:51)
git-committer:
Anders Kaseorg <andersk@mit.edu> (08/15/09 19:08:18)
Message:
Add const qualifiers for char * and void *.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
File:
1 edited

Legend:

Unmodified
Added
Removed
  • functions.c

    r65b2173 re19eb97  
    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)
     41owl_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)
     62void owl_function_show_view(const char *viewname)
    6363{
    6464  owl_view *v;
     
    9292}
    9393
    94 char *owl_function_style_describe(char *name) {
    95   char *desc;
     94char *owl_function_style_describe(const char *name) {
     95  const char *desc;
    9696  char *s;
    9797  owl_style *style;
     
    108108}
    109109
    110 char *owl_function_cmd_describe(char *name)
     110char *owl_function_cmd_describe(const char *name)
    111111{
    112112  owl_cmd *cmd = owl_cmddict_find(owl_global_get_cmddict(&g), name);
     
    115115}
    116116
    117 void owl_function_show_command(char *name)
     117void owl_function_show_command(const char *name)
    118118{
    119119  owl_function_help_for_command(name);
     
    122122void owl_function_show_license()
    123123{
    124   char *text;
     124  const char *text;
    125125
    126126  text=""
     
    168168void owl_function_show_quickstart()
    169169{
    170     char *message =
     170    const char *message =
    171171    "Move between messages with the arrow keys, and press 'r' to reply.\n"
    172172    "For more info, press 'h' or visit http://barnowl.mit.edu/\n\n"
     
    199199 * and redisplay if necessary.
    200200 */
    201 void owl_function_adminmsg(char *header, char *body)
     201void owl_function_adminmsg(const char *header, const char *body)
    202202{
    203203  owl_message *m;
     
    226226 * that.
    227227 */
    228 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)
    229229{
    230230  owl_message *m;
     
    247247 * owl_global_messagequeue_addmsg() for that .
    248248 */
    249 owl_message *owl_function_make_outgoing_aim(char *body, char *to)
     249owl_message *owl_function_make_outgoing_aim(const char *body, const char *to)
    250250{
    251251  owl_message *m;
     
    268268 * owl_global_messagequeue_addmsg() for that.
    269269 */
    270 owl_message *owl_function_make_outgoing_loopback(char *body)
     270owl_message *owl_function_make_outgoing_loopback(const char *body)
    271271{
    272272  owl_message *m;
     
    280280}
    281281
    282 void owl_function_zwrite_setup(char *line)
     282void owl_function_zwrite_setup(const char *line)
    283283{
    284284  owl_editwin *e;
     
    325325}
    326326
    327 void owl_function_aimwrite_setup(char *line)
     327void owl_function_aimwrite_setup(const char *line)
    328328{
    329329  owl_editwin *e;
     
    389389 * the message is expected to be set from the zwrite line itself
    390390 */
    391 void owl_function_zwrite(char *line, char *msg)
     391void owl_function_zwrite(const char *line, const char *msg)
    392392{
    393393  owl_zwrite z;
    394   char *mymsg;
     394  const char *mymsg;
    395395  owl_message *m;
    396396
     
    429429 * the message is expected to be set from the zwrite line itself
    430430 */
    431 void owl_function_zcrypt(char *line, char *msg)
     431void owl_function_zcrypt(const char *line, const char *msg)
    432432{
    433433  owl_zwrite z;
    434   char *mymsg;
     434  const char *mymsg;
    435435  char *cryptmsg;
    436436  owl_message *m;
     
    498498}
    499499
    500 void owl_function_aimwrite(char *line, char *msg)
     500void owl_function_aimwrite(const char *line, const char *msg)
    501501{
    502502  int ret;
    503   char *to;
     503  const char *to;
    504504  char *format_msg;
    505505  owl_message *m;
     
    531531}
    532532
    533 void owl_function_send_aimawymsg(char *to, char *msg)
     533void owl_function_send_aimawymsg(const char *to, const char *msg)
    534534{
    535535  int ret;
     
    563563}
    564564
    565 void owl_function_loopwrite(char *msg)
     565void owl_function_loopwrite(const char *msg)
    566566{
    567567  owl_message *min, *mout;
     
    590590 * If last_if_none, will stop at the last message in the view
    591591 * if no matching messages are found.  */
    592 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)
    593593{
    594594  int curmsg, i, viewsize, found;
     
    643643}
    644644
    645 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)
    646646{
    647647  int curmsg, i, viewsize, found;
     
    881881 * only, no error message is printed.
    882882 */
    883 void owl_function_loadsubs(char *file)
     883void owl_function_loadsubs(const char *file)
    884884{
    885885  int ret, ret2;
    886   char *foo;
     886  const char *foo;
    887887  char *path;
    888888
     
    914914}
    915915
    916 void owl_function_loadloginsubs(char *file)
     916void owl_function_loadloginsubs(const char *file)
    917917{
    918918  int ret;
     
    934934}
    935935
    936 void owl_function_aimlogin(char *user, char *passwd) {
     936void owl_function_aimlogin(const char *user, const char *passwd) {
    937937  int ret;
    938938
     
    12361236}
    12371237
    1238 void owl_function_debugmsg(char *fmt, ...)
     1238void owl_function_debugmsg(const char *fmt, ...)
    12391239{
    12401240  FILE *file;
     
    12711271}
    12721272
    1273 int owl_function_subscribe(char *class, char *inst, char *recip)
     1273int owl_function_subscribe(const char *class, const char *inst, const char *recip)
    12741274{
    12751275  int ret;
     
    12841284}
    12851285
    1286 void owl_function_unsubscribe(char *class, char *inst, char *recip)
     1286void owl_function_unsubscribe(const char *class, const char *inst, const char *recip)
    12871287{
    12881288  int ret;
     
    13261326}
    13271327
    1328 void owl_function_popless_text(char *text)
     1328void owl_function_popless_text(const char *text)
    13291329{
    13301330  owl_popwin *pw;
     
    13601360}
    13611361
    1362 void owl_function_popless_file(char *filename)
     1362void owl_function_popless_file(const char *filename)
    13631363{
    13641364  owl_fmtext fm;
     
    16651665void owl_function_printallvars()
    16661666{
    1667   char *name;
     1667  const char *name;
    16681668  char var[LINE];
    16691669  owl_list varnames;
     
    16951695  owl_fmtext fm; 
    16961696  int i, numvarnames;
    1697   char *varname;
     1697  const char *varname;
    16981698
    16991699  owl_fmtext_init_null(&fm);
     
    17131713}
    17141714
    1715 void owl_function_show_variable(char *name)
     1715void owl_function_show_variable(const char *name)
    17161716{
    17171717  owl_fmtext fm; 
     
    19391939}
    19401940
    1941 void owl_function_zlocate(int argc, char **argv, int auth)
     1941void owl_function_zlocate(int argc, const char *const *argv, int auth)
    19421942{
    19431943  owl_fmtext fm;
     
    19581958}
    19591959
    1960 void owl_function_start_command(char *line)
     1960void owl_function_start_command(const char *line)
    19611961{
    19621962  owl_editwin *tw;
     
    19771977}
    19781978
    1979 void owl_function_start_question(char *line)
     1979void owl_function_start_question(const char *line)
    19801980{
    19811981  owl_editwin *tw;
     
    19941994}
    19951995
    1996 void owl_function_start_password(char *line)
     1996void owl_function_start_password(const char *line)
    19971997{
    19981998  owl_editwin *tw;
     
    20122012}
    20132013
    2014 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)
    20152015{
    20162016  /* if type == 1 display in a popup
     
    20192019   * else display in a popup
    20202020   */
    2021   char *redirect = " 2>&1 < /dev/null";
     2021  const char *redirect = " 2>&1 < /dev/null";
    20222022  char *newbuff;
    20232023  char *out, buff2[1024];
     
    20672067}
    20682068
    2069 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)
    20702070{
    20712071  /* if type == 1 display in a popup
     
    21042104 * should have the pointer.
    21052105 */
    2106 void owl_function_change_currentview_filter(char *filtname)
     2106void owl_function_change_currentview_filter(const char *filtname)
    21072107{
    21082108  owl_view *v;
     
    21522152 * with a new definition.
    21532153 */
    2154 void owl_function_create_filter(int argc, char **argv)
     2154void owl_function_create_filter(int argc, const char *const *argv)
    21552155{
    21562156  owl_filter *f;
     
    22442244 * Returns the name of the negated filter, which the caller must free.
    22452245 */
    2246 char *owl_function_create_negative_filter(char *filtername)
     2246char *owl_function_create_negative_filter(const char *filtername)
    22472247{
    22482248  char *newname;
    22492249  owl_filter *tmpfilt;
    2250   char *argv[5];
     2250  const char *argv[5];
    22512251
    22522252  owl_function_debugmsg("owl_function_create_negative_filter");
     
    23002300}
    23012301
    2302 void owl_function_show_filter(char *name)
     2302void owl_function_show_filter(const char *name)
    23032303{
    23042304  owl_filter *f;
     
    23482348 * name of the filter, which the caller must free.
    23492349 */
    2350 char *owl_function_classinstfilt(char *c, char *i)
     2350char *owl_function_classinstfilt(const char *c, const char *i)
    23512351{
    23522352  owl_filter *f;
     
    24262426 * the filter, which the caller must free.
    24272427 */
    2428 char *owl_function_zuserfilt(char *user)
     2428char *owl_function_zuserfilt(const char *user)
    24292429{
    24302430  owl_filter *f;
     
    24732473 * Returns the name of the filter, which the caller must free.
    24742474 */
    2475 char *owl_function_aimuserfilt(char *user)
     2475char *owl_function_aimuserfilt(const char *user)
    24762476{
    24772477  owl_filter *f;
     
    25092509}
    25102510
    2511 char *owl_function_typefilt(char *type)
     2511char *owl_function_typefilt(const char *type)
    25122512{
    25132513  owl_filter *f;
     
    25822582  owl_message *m;
    25832583  char *zperson, *filtname=NULL;
    2584   char *argv[1];
     2584  const char *argv[1];
    25852585 
    25862586  v=owl_global_get_current_view(&g);
     
    26532653  owl_view *v;
    26542654  owl_message *m;
    2655   char *cmdprefix, *mclass, *minst;
     2655  const char *cmdprefix, *mclass, *minst;
    26562656  char *cmd;
    26572657 
     
    27022702 * be 'color'
    27032703 */
    2704 void owl_function_color_current_filter(char *fgcolor, char *bgcolor)
    2705 {
    2706   char *name;
     2704void owl_function_color_current_filter(const char *fgcolor, const char *bgcolor)
     2705{
     2706  const char *name;
    27072707
    27082708  name=owl_view_get_filtname(owl_global_get_current_view(&g));
     
    27142714 * the "all" filter, return -2.  Return 0 on success
    27152715 */
    2716 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)
    27172717{
    27182718  owl_filter *f;
     
    27972797 *   if direction==1 then unpunt
    27982798 */
    2799 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)
    28002800{
    28012801  char *puntexpr, *classexpr, *instexpr, *recipexpr;
     
    28442844}
    28452845
    2846 void owl_function_punt(char *filter, int direction)
     2846void owl_function_punt(const char *filter, int direction)
    28472847{
    28482848  owl_filter *f;
     
    28902890}
    28912891
    2892 void owl_function_activate_keymap(char *keymap)
     2892void owl_function_activate_keymap(const char *keymap)
    28932893{
    28942894  if (!owl_keyhandler_activate(owl_global_get_keyhandler(&g), keymap)) {
     
    29042904  owl_keyhandler *kh;
    29052905  int i, numkm;
    2906   char *kmname;
     2906  const char *kmname;
    29072907
    29082908  kh = owl_global_get_keyhandler(&g);
     
    29282928}
    29292929
    2930 char *owl_function_keymap_summary(char *name)
     2930char *owl_function_keymap_summary(const char *name)
    29312931{
    29322932  owl_keymap *km
     
    29372937
    29382938/* TODO: implement for real */
    2939 void owl_function_show_keymap(char *name)
     2939void owl_function_show_keymap(const char *name)
    29402940{
    29412941  owl_fmtext fm;
     
    29532953}
    29542954
    2955 void owl_function_help_for_command(char *cmdname)
     2955void owl_function_help_for_command(const char *cmdname)
    29562956{
    29572957  owl_fmtext fm;
     
    29632963}
    29642964
    2965 void owl_function_search_start(char *string, int direction)
     2965void owl_function_search_start(const char *string, int direction)
    29662966{
    29672967  /* direction is OWL_DIRECTION_DOWNWARDS or OWL_DIRECTION_UPWARDS or
     
    30593059/* strips formatting from ztext and returns the unformatted text.
    30603060 * caller is responsible for freeing. */
    3061 char *owl_function_ztext_stylestrip(char *zt)
     3061char *owl_function_ztext_stylestrip(const char *zt)
    30623062{
    30633063  owl_fmtext fm;
     
    30723072
    30733073/* Popup a buddylisting.  If filename is NULL use the default .anyone */
    3074 void owl_function_buddylist(int aim, int zephyr, char *filename)
     3074void owl_function_buddylist(int aim, int zephyr, const char *filename)
    30753075{
    30763076  int i, j, idle;
     
    30833083  int x;
    30843084  owl_list anyone;
    3085   char *user;
     3085  const char *user;
    30863086  char *tmp;
    30873087  ZLocations_t location[200];
     
    31893189
    31903190/* Dump messages in the current view to the file 'filename'. */
    3191 void owl_function_dump(char *filename)
     3191void owl_function_dump(const char *filename)
    31923192{
    31933193  int i, j, count;
     
    32993299 * startupfile.
    33003300 */
    3301 void owl_function_addstartup(char *buff)
     3301void owl_function_addstartup(const char *buff)
    33023302{
    33033303  FILE *file;
    3304   char *filename;
     3304  const char *filename;
    33053305
    33063306  filename=owl_global_get_startupfile(&g);
     
    33213321
    33223322/* Remove the specified command from the startup file. */
    3323 void owl_function_delstartup(char *buff)
    3324 {
    3325   char *filename;
     3323void owl_function_delstartup(const char *buff)
     3324{
     3325  const char *filename;
    33263326  filename=owl_global_get_startupfile(&g);
    33273327  owl_util_file_deleteline(filename, buff, 1);
     
    33313331 * is NULL, use the default owl startup commands file.
    33323332 */
    3333 void owl_function_source(char *filename)
     3333void owl_function_source(const char *filename)
    33343334{
    33353335  char *path;
     
    33603360}
    33613361
    3362 void owl_function_change_style(owl_view *v, char *stylename)
     3362void owl_function_change_style(owl_view *v, const char *stylename)
    33633363{
    33643364  owl_style *s;
     
    33943394}
    33953395
    3396 void owl_function_error(char *fmt, ...)
     3396void owl_function_error(const char *fmt, ...)
    33973397{
    33983398  va_list ap;
    33993399  char *buff;
    3400   char *nl;
     3400  const char *nl;
    34013401
    34023402  va_start(ap, fmt);
     
    34163416}
    34173417
    3418 void owl_function_log_err(char *string)
     3418void owl_function_log_err(const char *string)
    34193419{
    34203420  char *date;
     
    34443444}
    34453445
    3446 void owl_function_makemsg(char *fmt, ...)
     3446void owl_function_makemsg(const char *fmt, ...)
    34473447{
    34483448  va_list ap;
     
    34743474  owl_message *m;
    34753475  owl_zbuddylist *zbl;
    3476   char *user;
     3476  const char *user;
    34773477  ZLocations_t location[200];
    34783478  int numlocs, ret;
     
    35253525}
    35263526
    3527 void owl_function_aimsearch_results(char *email, owl_list *namelist)
     3527void owl_function_aimsearch_results(const char *email, owl_list *namelist)
    35283528{
    35293529  owl_fmtext fm;
Note: See TracChangeset for help on using the changeset viewer.