Changeset 01ff87d for zwrite.c


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'
File:
1 edited

Legend:

Unmodified
Added
Removed
  • zwrite.c

    r96cdeaf r01ff87d  
    55#include "owl.h"
    66
    7 int owl_zwrite_create_from_line(owl_zwrite *z, char *line)
     7int owl_zwrite_create_from_line(owl_zwrite *z, const char *line)
    88{
    99  int argc, badargs, myargc, i, len;
    10   char **argv, **myargv;
     10  char **argv;
     11  const char *const *myargv;
    1112  char *msg = NULL;
    1213
     
    2526
    2627  /* parse the command line for options */
    27   argv=myargv=owl_parseline(line, &argc);
     28  argv=owl_parseline(line, &argc);
     29  myargv=strs(argv);
    2830  if (argc<0) {
    2931    owl_function_error("Unbalanced quotes in zwrite");
     
    150152void owl_zwrite_populate_zsig(owl_zwrite *z)
    151153{
    152   char *zsigproc, *zsigowlvar, *zsigzvar, *ptr;
     154  const char *zsigproc, *zsigowlvar, *zsigzvar;
     155  char *ptr;
    153156  struct passwd *pw;
    154157
     
    200203}
    201204
    202 void owl_zwrite_send_ping(owl_zwrite *z)
     205void owl_zwrite_send_ping(const owl_zwrite *z)
    203206{
    204207  int i, j;
     
    216219  for (i=0; i<j; i++) {
    217220    if (strcmp(z->realm, "")) {
    218       to = owl_sprintf("%s@%s", (char *) owl_list_get_element(&(z->recips), i), z->realm);
     221      to = owl_sprintf("%s@%s", (const char *) owl_list_get_element(&(z->recips), i), z->realm);
    219222    } else {
    220223      to = owl_strdup(owl_list_get_element(&(z->recips), i));
     
    226229}
    227230
    228 void owl_zwrite_set_message(owl_zwrite *z, char *msg)
     231void owl_zwrite_set_message(owl_zwrite *z, const char *msg)
    229232{
    230233  int i, j;
     
    240243      tmp = toline;
    241244      if (strcmp(z->realm, "")) {
    242         toline = owl_sprintf( "%s%s@%s ", toline, (char *) owl_list_get_element(&(z->recips), i), z->realm);
     245        toline = owl_sprintf( "%s%s@%s ", toline, (const char *) owl_list_get_element(&(z->recips), i), z->realm);
    243246      } else {
    244         toline = owl_sprintf( "%s%s ", toline, (char *) owl_list_get_element(&(z->recips), i));
     247        toline = owl_sprintf( "%s%s ", toline, (const char *) owl_list_get_element(&(z->recips), i));
    245248      }
    246249      owl_free(tmp);
     
    260263}
    261264
    262 char *owl_zwrite_get_message(owl_zwrite *z)
     265const char *owl_zwrite_get_message(const owl_zwrite *z)
    263266{
    264267  if (z->message) return(z->message);
     
    266269}
    267270
    268 int owl_zwrite_is_message_set(owl_zwrite *z)
     271int owl_zwrite_is_message_set(const owl_zwrite *z)
    269272{
    270273  if (z->message) return(1);
     
    272275}
    273276
    274 int owl_zwrite_send_message(owl_zwrite *z)
     277int owl_zwrite_send_message(const owl_zwrite *z)
    275278{
    276279  int i, j;
     
    283286    for (i=0; i<j; i++) {
    284287      if (strcmp(z->realm, "")) {
    285         to = owl_sprintf("%s@%s", (char *) owl_list_get_element(&(z->recips), i), z->realm);
     288        to = owl_sprintf("%s@%s", (const char *) owl_list_get_element(&(z->recips), i), z->realm);
    286289      } else {
    287290        to = owl_strdup( owl_list_get_element(&(z->recips), i));
     
    299302}
    300303
    301 int owl_zwrite_create_and_send_from_line(char *cmd, char *msg)
     304int owl_zwrite_create_and_send_from_line(const char *cmd, const char *msg)
    302305{
    303306  owl_zwrite z;
     
    314317}
    315318
    316 char *owl_zwrite_get_class(owl_zwrite *z)
     319const char *owl_zwrite_get_class(const owl_zwrite *z)
    317320{
    318321  return(z->class);
    319322}
    320323
    321 char *owl_zwrite_get_instance(owl_zwrite *z)
     324const char *owl_zwrite_get_instance(const owl_zwrite *z)
    322325{
    323326  return(z->inst);
    324327}
    325328
    326 char *owl_zwrite_get_opcode(owl_zwrite *z)
     329const char *owl_zwrite_get_opcode(const owl_zwrite *z)
    327330{
    328331  return(z->opcode);
    329332}
    330333
    331 void owl_zwrite_set_opcode(owl_zwrite *z, char *opcode)
     334void owl_zwrite_set_opcode(owl_zwrite *z, const char *opcode)
    332335{
    333336  if (z->opcode) owl_free(z->opcode);
     
    335338}
    336339
    337 char *owl_zwrite_get_realm(owl_zwrite *z)
     340const char *owl_zwrite_get_realm(const owl_zwrite *z)
    338341{
    339342  return(z->realm);
    340343}
    341344
    342 char *owl_zwrite_get_zsig(owl_zwrite *z)
     345const char *owl_zwrite_get_zsig(const owl_zwrite *z)
    343346{
    344347  if (z->zsig) return(z->zsig);
     
    346349}
    347350
    348 void owl_zwrite_get_recipstr(owl_zwrite *z, char *buff)
     351void owl_zwrite_get_recipstr(const owl_zwrite *z, char *buff)
    349352{
    350353  int i, j;
     
    359362}
    360363
    361 int owl_zwrite_get_numrecips(owl_zwrite *z)
     364int owl_zwrite_get_numrecips(const owl_zwrite *z)
    362365{
    363366  return(owl_list_get_size(&(z->recips)));
    364367}
    365368
    366 char *owl_zwrite_get_recip_n(owl_zwrite *z, int n)
     369const char *owl_zwrite_get_recip_n(const owl_zwrite *z, int n)
    367370{
    368371  return(owl_list_get_element(&(z->recips), n));
    369372}
    370373
    371 int owl_zwrite_is_personal(owl_zwrite *z)
     374int owl_zwrite_is_personal(const owl_zwrite *z)
    372375{
    373376  /* return true if at least one of the recipients is personal */
Note: See TracChangeset for help on using the changeset viewer.