]> granicus.if.org Git - neomutt/commitdiff
url drop ciss
authorRichard Russon <rich@flatcap.org>
Mon, 7 Aug 2017 15:46:07 +0000 (16:46 +0100)
committerRichard Russon <rich@flatcap.org>
Thu, 10 Aug 2017 12:53:36 +0000 (13:53 +0100)
15 files changed:
account.c
account.h
bcache.c
browser.c
imap/command.c
imap/imap.c
imap/util.c
mutt_socket.c
newsrc.c
nntp.c
pop.c
pop_lib.c
smtp.c
url.c
url.h

index 74a260fd9799ed55d4e54bd421e3cc3f58250745..c8fc17bb53cd893551f0d7778b7e54594bba96a9 100644 (file)
--- a/account.c
+++ b/account.c
@@ -80,7 +80,7 @@ int mutt_account_match(const struct Account *a1, const struct Account *a2)
 /**
  * mutt_account_fromurl - fill account with information from url
  */
-int mutt_account_fromurl(struct Account *account, struct CissUrl *url)
+int mutt_account_fromurl(struct Account *account, struct Url *url)
 {
   /* must be present */
   if (url->host)
@@ -114,7 +114,7 @@ int mutt_account_fromurl(struct Account *account, struct CissUrl *url)
  * account until you've finished with url (make a copy of account if you need
  * it for a while).
  */
-void mutt_account_tourl(struct Account *account, struct CissUrl *url)
+void mutt_account_tourl(struct Account *account, struct Url *url)
 {
   url->scheme = U_UNKNOWN;
   url->user = NULL;
index baf758eab570201e495f8ff83bc24ab94f205597..59541d6c406712bfc8a462a67506ca7539e32af6 100644 (file)
--- a/account.h
+++ b/account.h
@@ -25,7 +25,7 @@
 #ifndef _MUTT_ACCOUNT_H
 #define _MUTT_ACCOUNT_H
 
-struct CissUrl;
+struct Url;
 
 /**
  * enum AccountType - account types
@@ -61,8 +61,8 @@ struct Account
 };
 
 int mutt_account_match(const struct Account *a1, const struct Account *m2);
-int mutt_account_fromurl(struct Account *account, struct CissUrl *url);
-void mutt_account_tourl(struct Account *account, struct CissUrl *url);
+int mutt_account_fromurl(struct Account *account, struct Url *url);
+void mutt_account_tourl(struct Account *account, struct Url *url);
 int mutt_account_getuser(struct Account *account);
 int mutt_account_getlogin(struct Account *account);
 int mutt_account_getpass(struct Account *account);
index a02d90f652c234935811fcd24bc24f2225a45231..51029c971bc27374a4e171b1934eba8cd755d7ab 100644 (file)
--- a/bcache.c
+++ b/bcache.c
@@ -49,21 +49,21 @@ static int bcache_path(struct Account *account, const char *mailbox, char *dst,
 {
   char host[STRING];
   char path[_POSIX_PATH_MAX];
-  struct CissUrl url;
+  struct Url url;
   int len;
 
   if (!account || !MessageCachedir || !*MessageCachedir || !dst || !dstlen)
     return -1;
 
-  /* make up a CissUrl we can turn into a string */
-  memset(&url, 0, sizeof(struct CissUrl));
+  /* make up a Url we can turn into a string */
+  memset(&url, 0, sizeof(struct Url));
   mutt_account_tourl(account, &url);
   /*
    * mutt_account_tourl() just sets up some pointers;
    * if this ever changes, we have a memleak here
    */
   url.path = NULL;
-  if (url_ciss_tostring(&url, host, sizeof(host), U_PATH) < 0)
+  if (url_tostring(&url, host, sizeof(host), U_PATH) < 0)
   {
     mutt_debug(1, "bcache_path: URL to string failed\n");
     return -1;
index d4b36d0c4d763216f67811bd66c636c19336a610..42b4c053012e6701df2b8b3cf133e0f75382706f 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -1382,14 +1382,14 @@ void _mutt_select_file(char *f, size_t flen, int flags, char ***files, int *numf
             else if (state.imap_browse)
             {
               int n;
-              struct CissUrl url;
+              struct Url url;
 
               strfcpy(LastDir, state.entry[menu->current].name, sizeof(LastDir));
               /* tack on delimiter here */
               n = strlen(LastDir) + 1;
 
               /* special case "" needs no delimiter */
-              url_parse_ciss(&url, state.entry[menu->current].name);
+              url_parse(&url, state.entry[menu->current].name);
               if (url.path && (state.entry[menu->current].delim != '\0') &&
                   (n < sizeof(LastDir)))
               {
index 894f1b7042885cdfddadfb912e8f5d19f981547d..a26b43aed16e9a1ccb44462ee816e3a24f27a8a1 100644 (file)
@@ -427,7 +427,7 @@ static void cmd_parse_lsub(struct ImapData *idata, char *s)
   char buf[STRING];
   char errstr[STRING];
   struct Buffer err, token;
-  struct CissUrl url;
+  struct Url url;
   struct ImapList list;
 
   if (idata->cmddata && idata->cmdtype == IMAP_CT_LIST)
@@ -458,7 +458,7 @@ static void cmd_parse_lsub(struct ImapData *idata, char *s)
   url.path[strlen(url.path) - 1] = '\0';
   if (mutt_strcmp(url.user, ImapUser) == 0)
     url.user = NULL;
-  url_ciss_tostring(&url, buf + 11, sizeof(buf) - 11, 0);
+  url_tostring(&url, buf + 11, sizeof(buf) - 11, 0);
   safe_strcat(buf, sizeof(buf), "\"");
   mutt_buffer_init(&token);
   mutt_buffer_init(&err);
index 25d703d6aa234cc447afebb4c5757a9cbdee16e4..f22d04d6491f2e7702d52eb5b957e2dff11685bd 100644 (file)
@@ -2082,7 +2082,7 @@ static int imap_complete_hosts(char *dest, size_t len)
 
   for (conn = mutt_socket_head(); conn; conn = conn->next)
   {
-    struct CissUrl url;
+    struct Url url;
     char urlstr[LONG_STRING];
 
     if (conn->account.type != MUTT_ACCT_TYPE_IMAP)
@@ -2092,7 +2092,7 @@ static int imap_complete_hosts(char *dest, size_t len)
     /* FIXME: how to handle multiple users on the same host? */
     url.user = NULL;
     url.path = NULL;
-    url_ciss_tostring(&url, urlstr, sizeof(urlstr), 0);
+    url_tostring(&url, urlstr, sizeof(urlstr), 0);
     if (mutt_strncmp(dest, urlstr, matchlen) == 0)
     {
       if (rc)
index bb6595bd0c1e1981dd6a12f693bf324593ee0277..1e060892485202cde59f55e4f397cf41cff71333 100644 (file)
  * and absolute form.  The buffer is rewritten in place with the canonical IMAP
  * path.
  *
- * Function can fail if imap_parse_path() or url_ciss_tostring() fail,
+ * Function can fail if imap_parse_path() or url_tostring() fail,
  * of if the buffer isn't large enough.
  */
 int imap_expand_path(char *path, size_t len)
 {
   struct ImapMbox mx;
   struct ImapData *idata = NULL;
-  struct CissUrl url;
+  struct Url url;
   char fixedpath[LONG_STRING];
   int rc;
 
@@ -87,7 +87,7 @@ int imap_expand_path(char *path, size_t len)
   imap_fix_path(idata, mx.mbox, fixedpath, sizeof(fixedpath));
   url.path = fixedpath;
 
-  rc = url_ciss_tostring(&url, path, len, U_DECODE_PASSWD);
+  rc = url_tostring(&url, path, len, U_DECODE_PASSWD);
   FREE(&mx.mbox);
 
   return rc;
@@ -202,7 +202,7 @@ static int imap_hcache_namer(const char *path, char *dest, size_t dlen)
 header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path)
 {
   struct ImapMbox mx;
-  struct CissUrl url;
+  struct Url url;
   char cachepath[LONG_STRING];
   char mbox[LONG_STRING];
 
@@ -219,7 +219,7 @@ header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path)
 
   mutt_account_tourl(&idata->conn->account, &url);
   url.path = mbox;
-  url_ciss_tostring(&url, cachepath, sizeof(cachepath), U_PATH);
+  url_tostring(&url, cachepath, sizeof(cachepath), U_PATH);
 
   return mutt_hcache_open(HeaderCache, cachepath, imap_hcache_namer);
 }
@@ -291,7 +291,7 @@ int imap_parse_path(const char *path, struct ImapMbox *mx)
   static unsigned short ImapsPort = 0;
   struct servent *service = NULL;
   char tmp[128];
-  struct CissUrl url;
+  struct Url url;
   char *c = NULL;
   int n;
 
@@ -320,7 +320,7 @@ int imap_parse_path(const char *path, struct ImapMbox *mx)
   mx->account.type = MUTT_ACCT_TYPE_IMAP;
 
   c = safe_strdup(path);
-  url_parse_ciss(&url, c);
+  url_parse(&url, c);
   if (url.scheme == U_IMAP || url.scheme == U_IMAPS)
   {
     if (mutt_account_fromurl(&mx->account, &url) < 0 || !*mx->account.host)
@@ -429,7 +429,7 @@ int imap_mxcmp(const char *mx1, const char *mx2)
 void imap_pretty_mailbox(char *path)
 {
   struct ImapMbox home, target;
-  struct CissUrl url;
+  struct Url url;
   char *delim = NULL;
   int tlen;
   int hlen = 0;
@@ -473,7 +473,7 @@ void imap_pretty_mailbox(char *path)
     /* FIXME: That hard-coded constant is bogus. But we need the actual
      *   size of the buffer from mutt_pretty_mailbox. And these pretty
      *   operations usually shrink the result. Still... */
-    url_ciss_tostring(&url, path, 1024, 0);
+    url_tostring(&url, path, 1024, 0);
   }
 
   FREE(&target.mbox);
@@ -752,12 +752,12 @@ void imap_make_date(char *buf, time_t timestamp)
  */
 void imap_qualify_path(char *dest, size_t len, struct ImapMbox *mx, char *path)
 {
-  struct CissUrl url;
+  struct Url url;
 
   mutt_account_tourl(&mx->account, &url);
   url.path = path;
 
-  url_ciss_tostring(&url, dest, len, 0);
+  url_tostring(&url, dest, len, 0);
 }
 
 /**
index 3f0b44c1d211b796429a7edd4bf32047247783e2..d4bb0167468e2c32dc08beb7f39c821b44554f91 100644 (file)
@@ -279,13 +279,13 @@ static struct Connection *socket_new_conn(void)
 struct Connection *mutt_conn_find(const struct Connection *start, const struct Account *account)
 {
   struct Connection *conn = NULL;
-  struct CissUrl url;
+  struct Url url;
   char hook[LONG_STRING];
 
   /* account isn't actually modified, since url isn't either */
   mutt_account_tourl((struct Account *) account, &url);
   url.path = NULL;
-  url_ciss_tostring(&url, hook, sizeof(hook), 0);
+  url_tostring(&url, hook, sizeof(hook), 0);
   mutt_account_hook(hook);
 
   conn = start ? start->next : Connections;
index 804db066da817bacce7462427ffb0b58ab8ffe3a..d959870f9aed3b444f77fed4b5896ac93dad2be8 100644 (file)
--- a/newsrc.c
+++ b/newsrc.c
@@ -513,11 +513,11 @@ static void cache_expand(char *dst, size_t dstlen, struct Account *acct, char *s
   /* server subdirectory */
   if (acct)
   {
-    struct CissUrl url;
+    struct Url url;
 
     mutt_account_tourl(acct, &url);
     url.path = src;
-    url_ciss_tostring(&url, file, sizeof(file), U_PATH);
+    url_tostring(&url, file, sizeof(file), U_PATH);
   }
   else
     strfcpy(file, src ? src : "", sizeof(file));
@@ -536,11 +536,11 @@ static void cache_expand(char *dst, size_t dstlen, struct Account *acct, char *s
  */
 void nntp_expand_path(char *line, size_t len, struct Account *acct)
 {
-  struct CissUrl url;
+  struct Url url;
 
   mutt_account_tourl(acct, &url);
   url.path = safe_strdup(line);
-  url_ciss_tostring(&url, line, len, 0);
+  url_tostring(&url, line, len, 0);
   FREE(&url.path);
 }
 
@@ -669,7 +669,7 @@ static int nntp_hcache_namer(const char *path, char *dest, size_t destlen)
  */
 header_cache_t *nntp_hcache_open(struct NntpData *nntp_data)
 {
-  struct CissUrl url;
+  struct Url url;
   char file[_POSIX_PATH_MAX];
 
   if (!nntp_data->nserv || !nntp_data->nserv->cacheable ||
@@ -679,7 +679,7 @@ header_cache_t *nntp_hcache_open(struct NntpData *nntp_data)
 
   mutt_account_tourl(&nntp_data->nserv->conn->account, &url);
   url.path = nntp_data->group;
-  url_ciss_tostring(&url, file, sizeof(file), U_PATH);
+  url_tostring(&url, file, sizeof(file), U_PATH);
   return mutt_hcache_open(NewsCacheDir, file, nntp_hcache_namer);
 }
 
@@ -872,14 +872,14 @@ const char *nntp_format_str(char *dest, size_t destlen, size_t col, int cols,
 {
   struct NntpServer *nserv = (struct NntpServer *) data;
   struct Account *acct = &nserv->conn->account;
-  struct CissUrl url;
+  struct Url url;
   char fn[SHORT_STRING], tmp[SHORT_STRING], *p = NULL;
 
   switch (op)
   {
     case 'a':
       mutt_account_tourl(acct, &url);
-      url_ciss_tostring(&url, fn, sizeof(fn), U_PATH);
+      url_tostring(&url, fn, sizeof(fn), U_PATH);
       p = strchr(fn, '/');
       if (p)
         *p = '\0';
@@ -906,7 +906,7 @@ const char *nntp_format_str(char *dest, size_t destlen, size_t col, int cols,
       break;
     case 'S':
       mutt_account_tourl(acct, &url);
-      url_ciss_tostring(&url, fn, sizeof(fn), U_PATH);
+      url_tostring(&url, fn, sizeof(fn), U_PATH);
       p = strchr(fn, ':');
       if (p)
         *p = '\0';
@@ -940,7 +940,7 @@ struct NntpServer *nntp_select_server(char *server, int leave_lock)
   struct NntpServer *nserv = NULL;
   struct NntpData *nntp_data = NULL;
   struct Connection *conn = NULL;
-  struct CissUrl url;
+  struct Url url;
 
   if (!server || !*server)
   {
@@ -954,7 +954,7 @@ struct NntpServer *nntp_select_server(char *server, int leave_lock)
   acct.port = NNTP_PORT;
   acct.type = MUTT_ACCT_TYPE_NNTP;
   snprintf(file, sizeof(file), "%s%s", strstr(server, "://") ? "" : "news://", server);
-  if (url_parse_ciss(&url, file) < 0 || (url.path && *url.path) ||
+  if (url_parse(&url, file) < 0 || (url.path && *url.path) ||
       !(url.scheme == U_NNTP || url.scheme == U_NNTPS) ||
       mutt_account_fromurl(&acct, &url) < 0)
   {
diff --git a/nntp.c b/nntp.c
index d98d54410a9ab01966bf5620fdf5176b908006e8..35afa5e38ea4168d1ce3656b71d0d39433c66647 100644 (file)
--- a/nntp.c
+++ b/nntp.c
@@ -1450,10 +1450,10 @@ static int nntp_open_mailbox(struct Context *ctx)
   int rc;
   void *hc = NULL;
   anum_t first, last, count = 0;
-  struct CissUrl url;
+  struct Url url;
 
   strfcpy(buf, ctx->path, sizeof(buf));
-  if (url_parse_ciss(&url, buf) < 0 || !url.path ||
+  if (url_parse(&url, buf) < 0 || !url.path ||
       !(url.scheme == U_NNTP || url.scheme == U_NNTPS))
   {
     mutt_error(_("%s is an invalid newsgroup specification!"), ctx->path);
@@ -1463,7 +1463,7 @@ static int nntp_open_mailbox(struct Context *ctx)
 
   group = url.path;
   url.path = strchr(url.path, '\0');
-  url_ciss_tostring(&url, server, sizeof(server), 0);
+  url_tostring(&url, server, sizeof(server), 0);
   nserv = nntp_select_server(server, 1);
   if (!nserv)
     return -1;
diff --git a/pop.c b/pop.c
index 1c4014faae1568d77492ca416b6e1a3eb7284ca4..03a0e36a255e1288e743c8fd82871cfab202f950 100644 (file)
--- a/pop.c
+++ b/pop.c
@@ -231,7 +231,7 @@ static int pop_hcache_namer(const char *path, char *dest, size_t destlen)
 
 static header_cache_t *pop_hcache_open(struct PopData *pop_data, const char *path)
 {
-  struct CissUrl url;
+  struct Url url;
   char p[LONG_STRING];
 
   if (!pop_data || !pop_data->conn)
@@ -239,7 +239,7 @@ static header_cache_t *pop_hcache_open(struct PopData *pop_data, const char *pat
 
   mutt_account_tourl(&pop_data->conn->account, &url);
   url.path = HC_FNAME;
-  url_ciss_tostring(&url, p, sizeof(p), U_PATH);
+  url_tostring(&url, p, sizeof(p), U_PATH);
   return mutt_hcache_open(HeaderCache, p, pop_hcache_namer);
 }
 #endif
@@ -424,7 +424,7 @@ static int pop_open_mailbox(struct Context *ctx)
   struct Connection *conn = NULL;
   struct Account acct;
   struct PopData *pop_data = NULL;
-  struct CissUrl url;
+  struct Url url;
 
   if (pop_parse_path(ctx->path, &acct))
   {
@@ -435,7 +435,7 @@ static int pop_open_mailbox(struct Context *ctx)
 
   mutt_account_tourl(&acct, &url);
   url.path = NULL;
-  url_ciss_tostring(&url, buf, sizeof(buf), 0);
+  url_tostring(&url, buf, sizeof(buf), 0);
   conn = mutt_conn_find(NULL, &acct);
   if (!conn)
     return -1;
index 4bd71d2c1d21a0d75e8a5530b76143e22f27c04f..9178f88b232705a9184ce2924b8f1de2635e465d 100644 (file)
--- a/pop_lib.c
+++ b/pop_lib.c
@@ -55,7 +55,7 @@
  */
 int pop_parse_path(const char *path, struct Account *acct)
 {
-  struct CissUrl url;
+  struct Url url;
   char *c = NULL;
   struct servent *service = NULL;
 
@@ -65,7 +65,7 @@ int pop_parse_path(const char *path, struct Account *acct)
   acct->port = 0;
 
   c = safe_strdup(path);
-  url_parse_ciss(&url, c);
+  url_parse(&url, c);
 
   if ((url.scheme != U_POP && url.scheme != U_POPS) || mutt_account_fromurl(acct, &url) < 0)
   {
diff --git a/smtp.c b/smtp.c
index 99282f62570bb265558a1cfe74adf4c21448cdc4..bef7e926d3d7e9c9dff415ace7643c2180e6d95e 100644 (file)
--- a/smtp.c
+++ b/smtp.c
@@ -283,7 +283,7 @@ static int smtp_fill_account(struct Account *account)
   static unsigned short SmtpPort = 0;
 
   struct servent *service = NULL;
-  struct CissUrl url;
+  struct Url url;
   char *urlstr = NULL;
 
   account->flags = 0;
@@ -291,7 +291,7 @@ static int smtp_fill_account(struct Account *account)
   account->type = MUTT_ACCT_TYPE_SMTP;
 
   urlstr = safe_strdup(SmtpUrl);
-  url_parse_ciss(&url, urlstr);
+  url_parse(&url, urlstr);
   if ((url.scheme != U_SMTP && url.scheme != U_SMTPS) ||
       mutt_account_fromurl(account, &url) < 0)
   {
diff --git a/url.c b/url.c
index d1c198e6feb596ab6a2c6de3b966ba0d1c9fd348..f2e70ab678acb753cef25d67e60a0991fb4b88b6 100644 (file)
--- a/url.c
+++ b/url.c
@@ -98,30 +98,30 @@ enum UrlScheme url_check_scheme(const char *s)
 }
 
 /**
- * ciss_parse_userhost - fill in components of ciss with info from src
+ * parse_userhost - fill in components of Url with info from src
  *
  * Note: These are pointers into src, which is altered with '\0's.
  *       Port of 0 means no port given.
  */
-static int ciss_parse_userhost(struct CissUrl *ciss, char *src)
+static int parse_userhost(struct Url *u, char *src)
 {
   char *t = NULL, *p = NULL;
 
-  ciss->user = NULL;
-  ciss->pass = NULL;
-  ciss->host = NULL;
-  ciss->port = 0;
+  u->user = NULL;
+  u->pass = NULL;
+  u->host = NULL;
+  u->port = 0;
 
   if (strncmp(src, "//", 2) != 0)
   {
-    ciss->path = src;
-    return url_pct_decode(ciss->path);
+    u->path = src;
+    return url_pct_decode(u->path);
   }
 
   src += 2;
 
-  if ((ciss->path = strchr(src, '/')))
-    *ciss->path++ = '\0';
+  if ((u->path = strchr(src, '/')))
+    *u->path++ = '\0';
 
   if ((t = strrchr(src, '@')))
   {
@@ -129,12 +129,12 @@ static int ciss_parse_userhost(struct CissUrl *ciss, char *src)
     if ((p = strchr(src, ':')))
     {
       *p = '\0';
-      ciss->pass = p + 1;
-      if (url_pct_decode(ciss->pass) < 0)
+      u->pass = p + 1;
+      if (url_pct_decode(u->pass) < 0)
         return -1;
     }
-    ciss->user = src;
-    if (url_pct_decode(ciss->user) < 0)
+    u->user = src;
+    if (url_pct_decode(u->user) < 0)
       return -1;
     src = t + 1;
   }
@@ -156,34 +156,31 @@ static int ciss_parse_userhost(struct CissUrl *ciss, char *src)
     *p++ = '\0';
     if (mutt_atoi(p, &num) < 0 || num < 0 || num > 0xffff)
       return -1;
-    ciss->port = (unsigned short) num;
+    u->port = (unsigned short) num;
   }
   else
-    ciss->port = 0;
+    u->port = 0;
 
-  ciss->host = src;
-  return url_pct_decode(ciss->host) >= 0 &&
-                 (!ciss->path || url_pct_decode(ciss->path) >= 0) ?
-             0 :
-             -1;
+  u->host = src;
+  return url_pct_decode(u->host) >= 0 && (!u->path || url_pct_decode(u->path) >= 0) ? 0 : -1;
 }
 
 /**
- * url_parse_ciss - Fill in CissUrl
+ * url_parse - Fill in Url
  *
  * char* elements are pointers into src, which is modified by this call
  * (duplicate it first if you need to).
  */
-int url_parse_ciss(struct CissUrl *ciss, char *src)
+int url_parse(struct Url *u, char *src)
 {
   char *tmp = NULL;
 
-  if ((ciss->scheme = url_check_scheme(src)) == U_UNKNOWN)
+  if ((u->scheme = url_check_scheme(src)) == U_UNKNOWN)
     return -1;
 
   tmp = strchr(src, ':') + 1;
 
-  return ciss_parse_userhost(ciss, tmp);
+  return parse_userhost(u, tmp);
 }
 
 void url_pct_encode(char *dst, size_t l, const char *src)
@@ -208,58 +205,58 @@ void url_pct_encode(char *dst, size_t l, const char *src)
 }
 
 /**
- * url_ciss_tostring - output the URL string for a given CISS object
+ * url_tostring - output the URL string for a given Url object
  */
-int url_ciss_tostring(struct CissUrl *ciss, char *dest, size_t len, int flags)
+int url_tostring(struct Url *u, char *dest, size_t len, int flags)
 {
   long l;
 
-  if (ciss->scheme == U_UNKNOWN)
+  if (u->scheme == U_UNKNOWN)
     return -1;
 
-  snprintf(dest, len, "%s:", mutt_getnamebyvalue(ciss->scheme, UrlMap));
+  snprintf(dest, len, "%s:", mutt_getnamebyvalue(u->scheme, UrlMap));
 
-  if (ciss->host)
+  if (u->host)
   {
     if (!(flags & U_PATH))
       safe_strcat(dest, len, "//");
     len -= (l = strlen(dest));
     dest += l;
 
-    if (ciss->user && (ciss->user[0] || !(flags & U_PATH)))
+    if (u->user && (u->user[0] || !(flags & U_PATH)))
     {
-      char u[STRING];
-      url_pct_encode(u, sizeof(u), ciss->user);
+      char str[STRING];
+      url_pct_encode(str, sizeof(str), u->user);
 
-      if (flags & U_DECODE_PASSWD && ciss->pass)
+      if (flags & U_DECODE_PASSWD && u->pass)
       {
         char p[STRING];
-        url_pct_encode(p, sizeof(p), ciss->pass);
-        snprintf(dest, len, "%s:%s@", u, p);
+        url_pct_encode(p, sizeof(p), u->pass);
+        snprintf(dest, len, "%s:%s@", str, p);
       }
       else
-        snprintf(dest, len, "%s@", u);
+        snprintf(dest, len, "%s@", str);
 
       len -= (l = strlen(dest));
       dest += l;
     }
 
-    if (strchr(ciss->host, ':'))
-      snprintf(dest, len, "[%s]", ciss->host);
+    if (strchr(u->host, ':'))
+      snprintf(dest, len, "[%s]", u->host);
     else
-      snprintf(dest, len, "%s", ciss->host);
+      snprintf(dest, len, "%s", u->host);
 
     len -= (l = strlen(dest));
     dest += l;
 
-    if (ciss->port)
-      snprintf(dest, len, ":%hu/", ciss->port);
+    if (u->port)
+      snprintf(dest, len, ":%hu/", u->port);
     else
       snprintf(dest, len, "/");
   }
 
-  if (ciss->path)
-    safe_strcat(dest, len, ciss->path);
+  if (u->path)
+    safe_strcat(dest, len, u->path);
 
   return 0;
 }
diff --git a/url.h b/url.h
index 1940d1ca2ea20421eaa32c897783701b087bd887..84243a50ef0a90ad2aabe44dbcb2db2478538488 100644 (file)
--- a/url.h
+++ b/url.h
@@ -50,9 +50,9 @@ enum UrlScheme
 #define U_PATH (1 << 1)
 
 /**
- * struct CissUrl - A parsed URL `proto://user:password@host/path`
+ * struct Url - A parsed URL `proto://user:password@host:port/path`
  */
-struct CissUrl
+struct Url
 {
   enum UrlScheme scheme;
   char *user;
@@ -63,8 +63,8 @@ struct CissUrl
 };
 
 enum UrlScheme url_check_scheme(const char *s);
-int url_parse_ciss(struct CissUrl *ciss, char *src);
-int url_ciss_tostring(struct CissUrl *ciss, char *dest, size_t len, int flags);
+int url_parse(struct Url *u, char *src);
+int url_tostring(struct Url *u, char *dest, size_t len, int flags);
 int url_parse_mailto(struct Envelope *e, char **body, const char *src);
 int url_pct_decode(char *s);
 void url_pct_encode(char *dest, size_t len, const char *src);