X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=nntp%2Fnewsrc.c;h=e9709f74f15a4748a9a5e237fbc9c25ee494f4b3;hp=29b427c2248c8e157a46738444081e3c9fcf4d19;hb=ac813896ca32d850febc2d95065ac4fa040f11f9;hpb=108f3c7ab59844591f7540347914ea57be5245e2 diff --git a/nntp/newsrc.c b/nntp/newsrc.c index 29b427c..e9709f7 100644 --- a/nntp/newsrc.c +++ b/nntp/newsrc.c @@ -58,7 +58,7 @@ static int nntp_parse_newsrc_line (NNTP_SERVER * news, char *line) char group[LONG_STRING]; int x = 1; char *p = line, *b, *h; - size_t len; + ssize_t len; while (*p) { if (*p++ == ',') @@ -172,7 +172,7 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news) struct stat st; char buf[HUGE_STRING], *cp; char dir[_POSIX_PATH_MAX], file[_POSIX_PATH_MAX]; - FILE *index; + FILE *idx; NNTP_DATA *data; int l, m, t; @@ -202,16 +202,16 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news) p_delete(&news->cache); snprintf (buf, sizeof (buf), "%s/.index", dir); - if (!(index = safe_fopen (buf, "a+"))) + if (!(idx = safe_fopen (buf, "a+"))) return 0; - rewind (index); - while (fgets (buf, sizeof (buf), index)) { + rewind (idx); + while (fgets (buf, sizeof (buf), idx)) { buf[m_strlen(buf) - 1] = 0; /* strip ending '\n' */ if (!m_strncmp(buf, "#: ", 3) && !m_strcasecmp(buf + 3, news->conn->account.host)) break; } - while (fgets (buf, sizeof (buf), index)) { + while (fgets (buf, sizeof (buf), idx)) { cp = buf; while (*cp && *cp != ' ') cp++; @@ -251,11 +251,11 @@ static int nntp_parse_cacheindex (NNTP_SERVER * news) mutt_newsgroup_stat (data); } } - fclose (index); + fclose (idx); return 0; } -const char *nntp_format_str (char *dest, size_t destlen, char op, +const char *nntp_format_str (char *dest, ssize_t destlen, char op, const char *src, const char *fmt, const char *ifstring, const char *elsestring, unsigned long data, format_flag flags) @@ -275,44 +275,44 @@ const char *nntp_format_str (char *dest, size_t destlen, char op, /* nntp_parse_url: given an NNPT URL, return host, port, * username, password and newsgroup will recognise. */ -int nntp_parse_url (const char *server, ACCOUNT * acct, - char *group, size_t group_len) +int nntp_parse_url (const char *server, ACCOUNT * act, + char *group, ssize_t group_len) { ciss_url_t url; char *c; int ret = -1; /* Defaults */ - acct->flags = 0; - acct->port = NNTP_PORT; - acct->type = M_ACCT_TYPE_NNTP; + act->flags = 0; + act->port = NNTP_PORT; + act->type = M_ACCT_TYPE_NNTP; c = m_strdup(server); url_parse_ciss (&url, c); if (url.scheme == U_NNTP || url.scheme == U_NNTPS) { if (url.scheme == U_NNTPS) { - acct->flags |= M_ACCT_SSL; - acct->port = NNTP_SSL_PORT; + act->flags |= M_ACCT_SSL; + act->port = NNTP_SSL_PORT; } *group = '\0'; if (url.path) m_strcpy(group, group_len, url.path); - ret = mutt_account_fromurl (acct, &url); + ret = mutt_account_fromurl (act, &url); } p_delete(&c); return ret; } -void nntp_expand_path (char *line, size_t len, ACCOUNT * acct) +void nntp_expand_path (char *line, ssize_t len, ACCOUNT * act) { ciss_url_t url; url.path = m_strdup(line); - mutt_account_tourl (acct, &url); + mutt_account_tourl (act, &url); url_ciss_tostring (&url, line, len, 0); p_delete(&url.path); } @@ -332,11 +332,11 @@ NNTP_SERVER *mutt_select_newsserver (char *server) char file[_POSIX_PATH_MAX]; char *buf, *p; string_list_t *list; - ACCOUNT acct; + ACCOUNT act; NNTP_SERVER *serv; CONNECTION *conn; - p_clear(&acct, 1); + p_clear(&act, 1); if (!server || !*server) { mutt_error _("No newsserver defined!"); @@ -351,14 +351,14 @@ NNTP_SERVER *mutt_select_newsserver (char *server) } strcpy (p, server); - if ((nntp_parse_url (buf, &acct, file, sizeof (file))) < 0 || *file) { + if ((nntp_parse_url (buf, &act, file, sizeof (file))) < 0 || *file) { p_delete(&buf); mutt_error (_("%s is an invalid newsserver specification!"), server); return NULL; } p_delete(&buf); - conn = mutt_conn_find (NULL, &acct); + conn = mutt_conn_find (NULL, &act); if (!conn) return NULL; @@ -499,10 +499,10 @@ static int puti (char *line, int num) } static void nntp_create_newsrc_line (NNTP_DATA * data, char **buf, - char **pline, size_t * buflen) + char **pline, ssize_t * buflen) { char *line = *pline; - size_t len = *buflen - (*pline - *buf); + ssize_t len = *buflen - (*pline - *buf); int x, i; if (len < LONG_STRING * 10) { @@ -747,7 +747,7 @@ int mutt_newsrc_update (NNTP_SERVER * news) NNTP_DATA *data; string_list_t *tmp; int r = -1; - size_t len, llen; + ssize_t len, llen; if (!news) return -1; @@ -1077,7 +1077,7 @@ NNTP_DATA *mutt_newsgroup_uncatchup (NNTP_SERVER * news, char *group) } /* this routine gives the first newsgroup with new messages */ -void nntp_buffy (char* dst, size_t dstlen) { +void nntp_buffy (char* dst, ssize_t dstlen) { string_list_t *list; int count = 0;