1994-09-27 19:49:25 +00:00
|
|
|
/* pop.c: client routines for talking to a POP3-protocol post-office server
|
2011-01-26 08:36:39 +00:00
|
|
|
|
2024-01-02 01:47:10 +00:00
|
|
|
Copyright (C) 1991, 1993, 1996-1997, 1999, 2001-2024 Free Software
|
2013-01-01 09:11:05 +00:00
|
|
|
Foundation, Inc.
|
2008-05-09 23:19:13 +00:00
|
|
|
|
|
|
|
Author: Jonathan Kamens <jik@security.ov.com>
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
This file is part of GNU Emacs.
|
|
|
|
|
2008-05-09 23:19:13 +00:00
|
|
|
GNU Emacs is free software: you can redistribute it and/or modify
|
1994-09-27 19:49:25 +00:00
|
|
|
it under the terms of the GNU General Public License as published by
|
2016-03-10 15:34:52 +00:00
|
|
|
the Free Software Foundation, either version 3 of the License, or (at
|
|
|
|
your option) any later version.
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
|
2008-05-09 23:19:13 +00:00
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
|
2001-12-29 22:25:06 +00:00
|
|
|
#include <config.h>
|
1994-10-18 07:36:39 +00:00
|
|
|
|
1994-10-19 22:52:57 +00:00
|
|
|
#ifdef MAIL_USE_POP
|
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
#include <sys/types.h>
|
1996-04-28 19:08:33 +00:00
|
|
|
#ifdef WINDOWSNT
|
|
|
|
#include "ntlib.h"
|
2016-03-05 10:12:58 +00:00
|
|
|
#undef _WIN32_WINNT
|
|
|
|
#define _WIN32_WINNT 0x0501 /* for getaddrinfo stuff */
|
2018-07-28 14:21:53 +00:00
|
|
|
#if defined __MINGW32_VERSION && __MINGW32_VERSION >= 5000002L
|
2018-07-28 12:34:00 +00:00
|
|
|
# include <windows.h>
|
|
|
|
#else
|
|
|
|
# include <winsock2.h>
|
|
|
|
#endif
|
|
|
|
# include <ws2tcpip.h>
|
2016-03-05 10:12:58 +00:00
|
|
|
#undef getaddrinfo
|
|
|
|
#define getaddrinfo sys_getaddrinfo
|
|
|
|
#undef freeaddrinfo
|
|
|
|
#define freeaddrinfo sys_freeaddrinfo
|
|
|
|
int sys_getaddrinfo (const char * node, const char * service,
|
|
|
|
const struct addrinfo * hints, struct addrinfo ** res);
|
|
|
|
void sys_freeaddrinfo (struct addrinfo * ai);
|
1996-04-28 19:08:33 +00:00
|
|
|
#undef SOCKET_ERROR
|
2011-09-09 01:06:52 +00:00
|
|
|
#define RECV(s,buf,len,flags) recv (s,buf,len,flags)
|
|
|
|
#define SEND(s,buf,len,flags) send (s,buf,len,flags)
|
|
|
|
#define CLOSESOCKET(s) closesocket (s)
|
1996-04-28 19:08:33 +00:00
|
|
|
#else
|
1994-09-27 19:49:25 +00:00
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <sys/socket.h>
|
2011-09-09 01:06:52 +00:00
|
|
|
#define RECV(s,buf,len,flags) read (s,buf,len)
|
|
|
|
#define SEND(s,buf,len,flags) write (s,buf,len)
|
|
|
|
#define CLOSESOCKET(s) close (s)
|
1996-04-28 19:08:33 +00:00
|
|
|
#endif
|
1994-09-27 19:49:25 +00:00
|
|
|
#include <pop.h>
|
1994-10-18 23:50:10 +00:00
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
#ifdef HESIOD
|
|
|
|
#include <hesiod.h>
|
|
|
|
/*
|
|
|
|
* It really shouldn't be necessary to put this declaration here, but
|
|
|
|
* the version of hesiod.h that Athena has installed in release 7.2
|
|
|
|
* doesn't declare this function; I don't know if the 7.3 version of
|
|
|
|
* hesiod.h does.
|
|
|
|
*/
|
|
|
|
extern struct servent *hes_getservbyname (/* char *, char * */);
|
|
|
|
#endif
|
1994-10-18 23:50:10 +00:00
|
|
|
|
Limit <config.h>’s includes
This follows up on recent problems with the fact that config.h
includes stdlib.h etc.; some files need to include stdlib.h later.
config.h generally should limit itself to includes that are
universally safe; outside of MS-Windows, only stdbool.h makes
the cut among the files currently included. So, move the
other includes to just the files that need them (Bug#24506).
* configure.ac (config_opsysfile): Remove, as this generic hook
is no longer needed.
* lib-src/etags.c, src/unexmacosx.c, src/w32.c, src/w32notify.c:
* src/w32proc.c (_GNU_SOURCE):
Remove, as it’s OK for config.h to do this now.
* src/conf_post.h: Include <ms-w32.h>, instead of the generic
config_opsysfile, for simplicity as this old way of configuring is
now done only for the MS-Windows port. Do not include <ms-w32.h>
if DEFER_MS_W32_H, for the benefit of the few files that want its
effects later. Do not include <alloca.h>, <string.h>, or
<stdlib.h>. Other files modified to include these headers as
needed, or to not include headers that are no longer needed.
* src/lisp.h: Include <alloca.h> and <string.h> here, since
some of the inline functions need them.
* src/regex.c: Include <alloca.h> if not emacs. (If emacs,
we can rely on SAFE_ALLOCA.) There is no longer any need to
worry about HAVE_ALLOCA_H.
* src/unexmacosx.c: Rely on config.h not including stdlib.h.
* src/w32.c, src/w32notify.c, src/w32proc.c (DEFER_MS_W32_H):
Define before including <config.h> first, and include <ms-w32.h>
after the troublesome headers.
2016-09-30 19:14:04 +00:00
|
|
|
#include <alloca.h>
|
1994-09-27 19:49:25 +00:00
|
|
|
#include <pwd.h>
|
|
|
|
#include <netdb.h>
|
|
|
|
#include <errno.h>
|
|
|
|
#include <stdio.h>
|
Limit <config.h>’s includes
This follows up on recent problems with the fact that config.h
includes stdlib.h etc.; some files need to include stdlib.h later.
config.h generally should limit itself to includes that are
universally safe; outside of MS-Windows, only stdbool.h makes
the cut among the files currently included. So, move the
other includes to just the files that need them (Bug#24506).
* configure.ac (config_opsysfile): Remove, as this generic hook
is no longer needed.
* lib-src/etags.c, src/unexmacosx.c, src/w32.c, src/w32notify.c:
* src/w32proc.c (_GNU_SOURCE):
Remove, as it’s OK for config.h to do this now.
* src/conf_post.h: Include <ms-w32.h>, instead of the generic
config_opsysfile, for simplicity as this old way of configuring is
now done only for the MS-Windows port. Do not include <ms-w32.h>
if DEFER_MS_W32_H, for the benefit of the few files that want its
effects later. Do not include <alloca.h>, <string.h>, or
<stdlib.h>. Other files modified to include these headers as
needed, or to not include headers that are no longer needed.
* src/lisp.h: Include <alloca.h> and <string.h> here, since
some of the inline functions need them.
* src/regex.c: Include <alloca.h> if not emacs. (If emacs,
we can rely on SAFE_ALLOCA.) There is no longer any need to
worry about HAVE_ALLOCA_H.
* src/unexmacosx.c: Rely on config.h not including stdlib.h.
* src/w32.c, src/w32notify.c, src/w32proc.c (DEFER_MS_W32_H):
Define before including <config.h> first, and include <ms-w32.h>
after the troublesome headers.
2016-09-30 19:14:04 +00:00
|
|
|
#include <stdlib.h>
|
1997-07-28 05:52:35 +00:00
|
|
|
#include <string.h>
|
1997-09-25 00:44:53 +00:00
|
|
|
#include <unistd.h>
|
1994-10-18 23:50:10 +00:00
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
#ifdef KERBEROS
|
1997-07-28 05:52:35 +00:00
|
|
|
# ifdef HAVE_KRB5_H
|
|
|
|
# include <krb5.h>
|
|
|
|
# endif
|
|
|
|
# ifdef HAVE_KRB_H
|
|
|
|
# include <krb.h>
|
|
|
|
# else
|
|
|
|
# ifdef HAVE_KERBEROSIV_KRB_H
|
|
|
|
# include <kerberosIV/krb.h>
|
|
|
|
# else
|
|
|
|
# ifdef HAVE_KERBEROS_KRB_H
|
|
|
|
# include <kerberos/krb.h>
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# endif
|
|
|
|
# ifdef HAVE_COM_ERR_H
|
|
|
|
# include <com_err.h>
|
|
|
|
# endif
|
1994-10-19 22:52:57 +00:00
|
|
|
#endif /* KERBEROS */
|
1994-09-27 19:49:25 +00:00
|
|
|
|
2016-08-28 08:56:51 +00:00
|
|
|
#include <c-ctype.h>
|
2011-02-21 23:22:34 +00:00
|
|
|
#include <min-max.h>
|
|
|
|
|
1994-10-19 22:52:57 +00:00
|
|
|
#ifdef KERBEROS
|
1997-07-28 05:52:35 +00:00
|
|
|
#ifndef KERBEROS5
|
1994-09-27 19:49:25 +00:00
|
|
|
extern int krb_sendauth (/* long, int, KTEXT, char *, char *, char *,
|
1994-10-19 22:52:57 +00:00
|
|
|
u_long, MSG_DAT *, CREDENTIALS *, Key_schedule,
|
|
|
|
struct sockaddr_in *, struct sockaddr_in *,
|
|
|
|
char * */);
|
1994-09-27 19:49:25 +00:00
|
|
|
extern char *krb_realmofhost (/* char * */);
|
1997-07-28 05:52:35 +00:00
|
|
|
#endif /* ! KERBEROS5 */
|
1994-10-19 22:52:57 +00:00
|
|
|
#endif /* KERBEROS */
|
1994-09-27 19:49:25 +00:00
|
|
|
|
2010-07-02 12:19:53 +00:00
|
|
|
static int socket_connection (char *, int);
|
|
|
|
static int pop_getline (popserver, char **);
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
static int sendline (popserver, const char *);
|
2010-07-02 12:19:53 +00:00
|
|
|
static int fullwrite (int, char *, int);
|
|
|
|
static int getok (popserver);
|
1994-09-27 19:49:25 +00:00
|
|
|
#if 0
|
2010-07-02 12:19:53 +00:00
|
|
|
static int gettermination (popserver);
|
1994-09-27 19:49:25 +00:00
|
|
|
#endif
|
2010-07-02 12:19:53 +00:00
|
|
|
static void pop_trash (popserver);
|
|
|
|
static char *find_crlf (char *, int);
|
1994-10-18 07:34:59 +00:00
|
|
|
|
2000-05-21 11:07:47 +00:00
|
|
|
#define ERROR_MAX 160 /* a pretty arbitrary size, but needs
|
2000-06-20 13:27:11 +00:00
|
|
|
to be bigger than the original
|
|
|
|
value of 80 */
|
1994-09-27 19:49:25 +00:00
|
|
|
#define POP_PORT 110
|
1996-04-28 19:08:33 +00:00
|
|
|
#define POP_SERVICE "pop3" /* we don't want the POP2 port! */
|
1994-09-27 19:49:25 +00:00
|
|
|
#ifdef KERBEROS
|
2011-02-21 18:37:35 +00:00
|
|
|
#define KPOP_PORT 1109
|
2006-05-23 10:44:39 +00:00
|
|
|
#define KPOP_SERVICE "kpop" /* never used: look for 20060515 to see why */
|
1994-09-27 19:49:25 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
char pop_error[ERROR_MAX];
|
Use bool for boolean, focusing on headers.
* configure.ac (PTY_OPEN, GC_MARK_SECONDARY_STACK):
Use bool for boolean.
* lib-src/emacsclient.c, lib-src/etags.c, lib-src/hexl.c (FALSE, TRUE):
Remove. All uses replaced with uncapitalized version.
* lib-src/emacsclient.c (message):
* lib-src/etags.c (make_tag, pfnote, consider_token, make_C_tag, lang_names):
* lib-src/hexl.c (un_flag, iso_flag, endian):
* lib-src/pop.c (pop_debug, pop_open, pop_multi_first, pop_multi_next)
(pop_trash):
Use bool for boolean.
* lib-src/etags.c (bool): Remove.
* lib-src/etags.c (globals, members, declarations, no_line_directive)
(no_duplicates): Use 'int' for boolean values that getopt requires
to be 'int'. Formerly, these were 'bool' and 'bool' was 'int',
but we can no longer rely on this implementation.
* lib-src/pop.h (struct _popserver): Use bool_bf for boolean bit-fields.
* lwlib/xlwmenuP.h (XlwMenu_part): Use bool_bf for boolean bit-fields.
* src/atimer.h, src/lisp.h, src/syssignal.h, src/syswait.h, src/unexelf.c:
No need to include <stdbool.h>, since conf_post.h does it now.
* src/buffer.h (BUF_COMPUTE_UNCHANGED, DECODE_POSITION)
(BUFFER_CHECK_INDIRECTION, GET_OVERLAYS_AT, PER_BUFFER_VALUE_P)
(SET_PER_BUFFER_VALUE_P):
* src/ccl.c, src/ccl.h (setup_ccl_program):
* src/ccl.h (CHECK_CCL_PROGRAM):
* src/character.h (MAKE_CHAR_UNIBYTE, CHECK_CHARACTER_CAR)
(CHECK_CHARACTER_CDR, CHAR_STRING_ADVANCE, NEXT_CHAR_BOUNDARY)
(PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE)
(FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE)
(FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE)
(FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH)
(DEC_BOTH, BUF_INC_POS, BUF_DEC_POS):
* src/charset.h (CHECK_CHARSET, CHECK_CHARSET_GET_ID)
(CHECK_CHARSET_GET_ATTR, CHECK_CHARSET_GET_CHARSET)
(CHARSET_FAST_MAP_SET):
* src/coding.c (decode_coding_ccl, encode_coding_ccl):
* src/coding.h (CHECK_CODING_SYSTEM, CHECK_CODING_SYSTEM_GET_SPEC)
(CHECK_CODING_SYSTEM_GET_ID, SJIS_TO_JIS, SJIS_TO_JIS2)
(JIS_TO_SJIS, JIS_TO_SJIS2, ENCODE_FILE, DECODE_FILE)
(ENCODE_SYSTEM, DECODE_SYSTEM, ENCODE_UTF_8)
(decode_coding_c_string):
* src/composite.h (COMPOSITION_DECODE_REFS, COMPOSITION_DECODE_RULE):
* src/conf_post.h (has_attribute):
* src/dispextern.h (trace_redisplay_p):
(INC_TEXT_POS, DEC_TEXT_POS, SET_GLYPH_FROM_GLYPH_CODE)
(SET_CHAR_GLYPH, SET_CHAR_GLYPH_FROM_GLYPH)
(SET_GLYPH_FROM_CHAR_GLYPH):
(WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P)
(FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_SUITABLE_FOR_CHAR_P)
(PRODUCE_GLYPHS, reset_mouse_highlight, in_display_vector_p)
(cursor_in_mouse_face_p):
* src/dispnew.c (adjust_glyph_matrix, clear_glyph_matrix_rows)
(blank_row, prepare_desired_row)
(build_frame_matrix_from_leaf_window, make_current)
(mirror_make_current, mirrored_line_dance, mirror_line_dance)
(update_window, scrolling_window, update_frame_line):
* src/disptab.h (GLYPH_FOLLOW_ALIASES):
* src/editfns.c (Fformat):
* src/font.h (FONT_WEIGHT_SYMBOLIC, FONT_SLANT_SYMBOLIC)
(FONT_WIDTH_SYMBOLIC, FONT_WEIGHT_FOR_FACE, FONT_SLANT_FOR_FACE)
(FONT_WIDTH_FOR_FACE, FONT_WEIGHT_NAME_NUMERIC)
(FONT_SLANT_NAME_NUMERIC, FONT_WIDTH_NAME_NUMERIC)
(FONT_SET_STYLE, CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY)
(CHECK_FONT_OBJECT, CHECK_FONT_GET_OBJECT, FONT_ADD_LOG)
(FONT_DEFERRED_LOG):
* src/frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_WINDOW_P):
(FRAME_EXTERNAL_TOOL_BAR, FRAME_EXTERNAL_MENU_BAR, FOR_EACH_FRAME)
(FRAME_MOUSE_UPDATE):
* src/fringe.c (Fdefine_fringe_bitmap):
* src/image.c (x_create_bitmap_from_data, x_create_bitmap_mask)
(x_create_bitmap_from_xpm_data, xpm_load_image):
* src/intervals.h (INTERVAL_HAS_PARENT, INTERVAL_PARENT)
(set_interval_parent, RESET_INTERVAL, COPY_INTERVAL_CACHE)
(MERGE_INTERVAL_CACHE):
* src/keymap.h (KEYMAPP):
* src/lisp.h (eassert, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE)
(STRING_SET_UNIBYTE, STRING_SET_MULTIBYTE, DEFSYM, PSEUDOVECTORP)
(CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER)
(CHECK_NUMBER_COERCE_MARKER, CHECK_NUMBER_OR_FLOAT_COERCE_MARKER)
(DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT)
(DEFVAR_BUFFER_DEFAULTS, DEFVAR_KBOARD, QUIT)
(RETURN_UNGCPRO, USE_SAFE_ALLOCA, SAFE_NALLOCA, SAFE_FREE)
(SAFE_ALLOCA_LISP, FOR_EACH_ALIST_VALUE, functionp):
* src/syntax.h (SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX)
(UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD)
(SETUP_BUFFER_SYNTAX_TABLE):
* src/systime.h (timespec_valid_p):
* src/term.c (save_and_enable_current_matrix):
* src/window.h (WINDOW_MENU_BAR_P, WINDOW_TOOL_BAR_P):
* src/xdisp.c (in_display_vector_p, display_tool_bar_line)
(redisplay_internal, try_window_reusing_current_matrix)
(sync_frame_with_window_matrix_rows, try_window_id)
(display_menu_bar, display_tty_menu_item, display_mode_line)
(coords_in_mouse_face_p, cursor_in_mouse_face_p):
* src/xmenu.c (xmenu_show):
* src/xterm.c (use_xim, x_term_init):
* src/xterm.h (XSync, GTK_CHECK_VERSION, use_xim, SET_SCROLL_BAR_X_WIDGET)
(struct x_bitmap_record):
Use bool for booleans.
* src/ccl.c (struct buffer_text):
* src/ccl.h (struct ccl_program):
* src/charset.h (struct charset):
* src/cm.h (struct cm):
* src/coding.h (struct iso_2022_spec, struct coding_system):
* src/dispextern.h (struct glyph, struct glyph_matrix, struct glyph_row)
(struct glyph_string, struct face, struct face_cache)
(struct bidi_string_data, struct bidi_it)
(struct draw_fringe_bitmap_params, struct it, Mouse_HLInfo)
(struct image):
* src/editfns.c (Fformat):
* src/frame.h (struct frame):
* src/fringe.c (struct fringe_bitmap):
* src/intervals.h (struct interval):
* src/keyboard.h (struct kboard):
* src/lisp.h (struct Lisp_Symbol, struct Lisp_Misc_Any, struct Lisp_Marker)
(struct Lisp_Overlay, struct Lisp_Save_Value, struct Lisp_Free)
(struct Lisp_Buffer_Local_Value, union specbinding):
* src/macfont.m (struct macfont_info):
* src/process.h (struct Lisp_Process):
* src/termchar.h (struct tty_display_info):
* src/window.h (struct window):
* src/xterm.h (struct x_output):
Use bool_bf for boolean bit-fields.
* src/ccl.c (setup_ccl_program): Now returns bool instead of -1 or 0.
All callers changed.
* src/ccl.h (struct ccl_program): Remove unused members private_state,
src_multibyte, dst_multibyte, cr_consumed, suppress_error,
eight_bit_control.
(struct ccl_spec): Remove unused members cr_carryover,
eight_bit_carryover.
* src/conf_post.h: Include <stdbool.h>.
(bool_bf): New type.
* src/dispextern.h (TRACE, PREPARE_FACE_FOR_DISPLAY):
* src/interval.h (RESET_INTERVAL, COPY_INTERVAL_CACHE, MERGE_INTERVAL_CACHE)
Surround statement macro with proper 'do { ... } while (false)' brackets.
(SET_MATRIX_ROW_ENABLED_P): Assume 2nd arg is bool.
(PRODUCE_GLYPHS): Simplify use of boolean.
* src/fileio.c (Fcopy_file):
If I is an integer, prefer 'if (I != 0)' to 'if (I)'.
* src/lisp.h (UNGCPRO): Return void, not int.
(FOR_EACH_TAIL): Use void expression, not int expression.
* src/region-cache.c: Reindent.
* src/region-cache.h: Copy comments from region-cache.c, to fix
incorrect remarks about booleans.
2013-12-14 21:36:44 +00:00
|
|
|
bool pop_debug = false;
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: pop_open (char *host, char *username, char *password,
|
|
|
|
* int flags)
|
|
|
|
*
|
|
|
|
* Purpose: Establishes a connection with a post-office server, and
|
|
|
|
* completes the authorization portion of the session.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* host The server host with which the connection should be
|
|
|
|
* established. Optional. If omitted, internal
|
|
|
|
* heuristics will be used to determine the server host,
|
|
|
|
* if possible.
|
|
|
|
* username
|
|
|
|
* The username of the mail-drop to access. Optional.
|
|
|
|
* If omitted, internal heuristics will be used to
|
|
|
|
* determine the username, if possible.
|
|
|
|
* password
|
|
|
|
* The password to use for authorization. If omitted,
|
|
|
|
* internal heuristics will be used to determine the
|
|
|
|
* password, if possible.
|
|
|
|
* flags A bit mask containing flags controlling certain
|
|
|
|
* functions of the routine. Valid flags are defined in
|
|
|
|
* the file pop.h
|
|
|
|
*
|
|
|
|
* Return value: Upon successful establishment of a connection, a
|
|
|
|
* non-null popserver will be returned. Otherwise, null will be
|
|
|
|
* returned, and the string variable pop_error will contain an
|
|
|
|
* explanation of the error.
|
|
|
|
*/
|
|
|
|
popserver
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_open (char *host, char *username, char *password, int flags)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
int sock;
|
|
|
|
popserver server;
|
|
|
|
|
|
|
|
/* Determine the user name */
|
|
|
|
if (! username)
|
|
|
|
{
|
|
|
|
username = getenv ("USER");
|
|
|
|
if (! (username && *username))
|
|
|
|
{
|
|
|
|
username = getlogin ();
|
|
|
|
if (! (username && *username))
|
|
|
|
{
|
|
|
|
struct passwd *passwd;
|
|
|
|
passwd = getpwuid (getuid ());
|
|
|
|
if (passwd && passwd->pw_name && *passwd->pw_name)
|
|
|
|
{
|
|
|
|
username = passwd->pw_name;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "Could not determine username");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Determine the mail host.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (! host)
|
|
|
|
{
|
|
|
|
host = getenv ("MAILHOST");
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef HESIOD
|
|
|
|
if ((! host) && (! (flags & POP_NO_HESIOD)))
|
|
|
|
{
|
|
|
|
struct hes_postoffice *office;
|
|
|
|
office = hes_getmailhost (username);
|
|
|
|
if (office && office->po_type && (! strcmp (office->po_type, "POP"))
|
|
|
|
&& office->po_name && *office->po_name && office->po_host
|
|
|
|
&& *office->po_host)
|
|
|
|
{
|
|
|
|
host = office->po_host;
|
|
|
|
username = office->po_name;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef MAILHOST
|
|
|
|
if (! host)
|
|
|
|
{
|
|
|
|
host = MAILHOST;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if (! host)
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "Could not determine POP server");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Determine the password */
|
1998-05-25 20:11:54 +00:00
|
|
|
#ifdef KERBEROS
|
|
|
|
#define DONT_NEED_PASSWORD (! (flags & POP_NO_KERBEROS))
|
1994-09-27 19:49:25 +00:00
|
|
|
#else
|
1998-05-25 20:11:54 +00:00
|
|
|
#define DONT_NEED_PASSWORD 0
|
1994-09-27 19:49:25 +00:00
|
|
|
#endif
|
2003-02-04 14:56:31 +00:00
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
if ((! password) && (! DONT_NEED_PASSWORD))
|
|
|
|
{
|
|
|
|
if (! (flags & POP_NO_GETPASS))
|
|
|
|
{
|
|
|
|
password = getpass ("Enter POP password:");
|
|
|
|
}
|
|
|
|
if (! password)
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "Could not determine POP password");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
2006-05-23 10:44:39 +00:00
|
|
|
if (password) /* always true, detected 20060515 */
|
1998-05-25 20:11:54 +00:00
|
|
|
flags |= POP_NO_KERBEROS;
|
1994-09-27 19:49:25 +00:00
|
|
|
else
|
2006-05-23 10:44:39 +00:00
|
|
|
password = username; /* dead code, detected 20060515 */
|
|
|
|
/** "kpop" service is never used: look for 20060515 to see why **/
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
sock = socket_connection (host, flags);
|
|
|
|
if (sock == -1)
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
server = (popserver) malloc (sizeof (struct _popserver));
|
|
|
|
if (! server)
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "Out of memory in pop_open");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
server->buffer = (char *) malloc (GETLINE_MIN);
|
|
|
|
if (! server->buffer)
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "Out of memory in pop_open");
|
|
|
|
free ((char *) server);
|
|
|
|
return (0);
|
|
|
|
}
|
2001-12-30 22:09:01 +00:00
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
server->file = sock;
|
|
|
|
server->data = 0;
|
|
|
|
server->buffer_index = 0;
|
|
|
|
server->buffer_size = GETLINE_MIN;
|
Use bool for boolean, focusing on headers.
* configure.ac (PTY_OPEN, GC_MARK_SECONDARY_STACK):
Use bool for boolean.
* lib-src/emacsclient.c, lib-src/etags.c, lib-src/hexl.c (FALSE, TRUE):
Remove. All uses replaced with uncapitalized version.
* lib-src/emacsclient.c (message):
* lib-src/etags.c (make_tag, pfnote, consider_token, make_C_tag, lang_names):
* lib-src/hexl.c (un_flag, iso_flag, endian):
* lib-src/pop.c (pop_debug, pop_open, pop_multi_first, pop_multi_next)
(pop_trash):
Use bool for boolean.
* lib-src/etags.c (bool): Remove.
* lib-src/etags.c (globals, members, declarations, no_line_directive)
(no_duplicates): Use 'int' for boolean values that getopt requires
to be 'int'. Formerly, these were 'bool' and 'bool' was 'int',
but we can no longer rely on this implementation.
* lib-src/pop.h (struct _popserver): Use bool_bf for boolean bit-fields.
* lwlib/xlwmenuP.h (XlwMenu_part): Use bool_bf for boolean bit-fields.
* src/atimer.h, src/lisp.h, src/syssignal.h, src/syswait.h, src/unexelf.c:
No need to include <stdbool.h>, since conf_post.h does it now.
* src/buffer.h (BUF_COMPUTE_UNCHANGED, DECODE_POSITION)
(BUFFER_CHECK_INDIRECTION, GET_OVERLAYS_AT, PER_BUFFER_VALUE_P)
(SET_PER_BUFFER_VALUE_P):
* src/ccl.c, src/ccl.h (setup_ccl_program):
* src/ccl.h (CHECK_CCL_PROGRAM):
* src/character.h (MAKE_CHAR_UNIBYTE, CHECK_CHARACTER_CAR)
(CHECK_CHARACTER_CDR, CHAR_STRING_ADVANCE, NEXT_CHAR_BOUNDARY)
(PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE)
(FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE)
(FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE)
(FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH)
(DEC_BOTH, BUF_INC_POS, BUF_DEC_POS):
* src/charset.h (CHECK_CHARSET, CHECK_CHARSET_GET_ID)
(CHECK_CHARSET_GET_ATTR, CHECK_CHARSET_GET_CHARSET)
(CHARSET_FAST_MAP_SET):
* src/coding.c (decode_coding_ccl, encode_coding_ccl):
* src/coding.h (CHECK_CODING_SYSTEM, CHECK_CODING_SYSTEM_GET_SPEC)
(CHECK_CODING_SYSTEM_GET_ID, SJIS_TO_JIS, SJIS_TO_JIS2)
(JIS_TO_SJIS, JIS_TO_SJIS2, ENCODE_FILE, DECODE_FILE)
(ENCODE_SYSTEM, DECODE_SYSTEM, ENCODE_UTF_8)
(decode_coding_c_string):
* src/composite.h (COMPOSITION_DECODE_REFS, COMPOSITION_DECODE_RULE):
* src/conf_post.h (has_attribute):
* src/dispextern.h (trace_redisplay_p):
(INC_TEXT_POS, DEC_TEXT_POS, SET_GLYPH_FROM_GLYPH_CODE)
(SET_CHAR_GLYPH, SET_CHAR_GLYPH_FROM_GLYPH)
(SET_GLYPH_FROM_CHAR_GLYPH):
(WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P)
(FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_SUITABLE_FOR_CHAR_P)
(PRODUCE_GLYPHS, reset_mouse_highlight, in_display_vector_p)
(cursor_in_mouse_face_p):
* src/dispnew.c (adjust_glyph_matrix, clear_glyph_matrix_rows)
(blank_row, prepare_desired_row)
(build_frame_matrix_from_leaf_window, make_current)
(mirror_make_current, mirrored_line_dance, mirror_line_dance)
(update_window, scrolling_window, update_frame_line):
* src/disptab.h (GLYPH_FOLLOW_ALIASES):
* src/editfns.c (Fformat):
* src/font.h (FONT_WEIGHT_SYMBOLIC, FONT_SLANT_SYMBOLIC)
(FONT_WIDTH_SYMBOLIC, FONT_WEIGHT_FOR_FACE, FONT_SLANT_FOR_FACE)
(FONT_WIDTH_FOR_FACE, FONT_WEIGHT_NAME_NUMERIC)
(FONT_SLANT_NAME_NUMERIC, FONT_WIDTH_NAME_NUMERIC)
(FONT_SET_STYLE, CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY)
(CHECK_FONT_OBJECT, CHECK_FONT_GET_OBJECT, FONT_ADD_LOG)
(FONT_DEFERRED_LOG):
* src/frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_WINDOW_P):
(FRAME_EXTERNAL_TOOL_BAR, FRAME_EXTERNAL_MENU_BAR, FOR_EACH_FRAME)
(FRAME_MOUSE_UPDATE):
* src/fringe.c (Fdefine_fringe_bitmap):
* src/image.c (x_create_bitmap_from_data, x_create_bitmap_mask)
(x_create_bitmap_from_xpm_data, xpm_load_image):
* src/intervals.h (INTERVAL_HAS_PARENT, INTERVAL_PARENT)
(set_interval_parent, RESET_INTERVAL, COPY_INTERVAL_CACHE)
(MERGE_INTERVAL_CACHE):
* src/keymap.h (KEYMAPP):
* src/lisp.h (eassert, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE)
(STRING_SET_UNIBYTE, STRING_SET_MULTIBYTE, DEFSYM, PSEUDOVECTORP)
(CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER)
(CHECK_NUMBER_COERCE_MARKER, CHECK_NUMBER_OR_FLOAT_COERCE_MARKER)
(DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT)
(DEFVAR_BUFFER_DEFAULTS, DEFVAR_KBOARD, QUIT)
(RETURN_UNGCPRO, USE_SAFE_ALLOCA, SAFE_NALLOCA, SAFE_FREE)
(SAFE_ALLOCA_LISP, FOR_EACH_ALIST_VALUE, functionp):
* src/syntax.h (SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX)
(UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD)
(SETUP_BUFFER_SYNTAX_TABLE):
* src/systime.h (timespec_valid_p):
* src/term.c (save_and_enable_current_matrix):
* src/window.h (WINDOW_MENU_BAR_P, WINDOW_TOOL_BAR_P):
* src/xdisp.c (in_display_vector_p, display_tool_bar_line)
(redisplay_internal, try_window_reusing_current_matrix)
(sync_frame_with_window_matrix_rows, try_window_id)
(display_menu_bar, display_tty_menu_item, display_mode_line)
(coords_in_mouse_face_p, cursor_in_mouse_face_p):
* src/xmenu.c (xmenu_show):
* src/xterm.c (use_xim, x_term_init):
* src/xterm.h (XSync, GTK_CHECK_VERSION, use_xim, SET_SCROLL_BAR_X_WIDGET)
(struct x_bitmap_record):
Use bool for booleans.
* src/ccl.c (struct buffer_text):
* src/ccl.h (struct ccl_program):
* src/charset.h (struct charset):
* src/cm.h (struct cm):
* src/coding.h (struct iso_2022_spec, struct coding_system):
* src/dispextern.h (struct glyph, struct glyph_matrix, struct glyph_row)
(struct glyph_string, struct face, struct face_cache)
(struct bidi_string_data, struct bidi_it)
(struct draw_fringe_bitmap_params, struct it, Mouse_HLInfo)
(struct image):
* src/editfns.c (Fformat):
* src/frame.h (struct frame):
* src/fringe.c (struct fringe_bitmap):
* src/intervals.h (struct interval):
* src/keyboard.h (struct kboard):
* src/lisp.h (struct Lisp_Symbol, struct Lisp_Misc_Any, struct Lisp_Marker)
(struct Lisp_Overlay, struct Lisp_Save_Value, struct Lisp_Free)
(struct Lisp_Buffer_Local_Value, union specbinding):
* src/macfont.m (struct macfont_info):
* src/process.h (struct Lisp_Process):
* src/termchar.h (struct tty_display_info):
* src/window.h (struct window):
* src/xterm.h (struct x_output):
Use bool_bf for boolean bit-fields.
* src/ccl.c (setup_ccl_program): Now returns bool instead of -1 or 0.
All callers changed.
* src/ccl.h (struct ccl_program): Remove unused members private_state,
src_multibyte, dst_multibyte, cr_consumed, suppress_error,
eight_bit_control.
(struct ccl_spec): Remove unused members cr_carryover,
eight_bit_carryover.
* src/conf_post.h: Include <stdbool.h>.
(bool_bf): New type.
* src/dispextern.h (TRACE, PREPARE_FACE_FOR_DISPLAY):
* src/interval.h (RESET_INTERVAL, COPY_INTERVAL_CACHE, MERGE_INTERVAL_CACHE)
Surround statement macro with proper 'do { ... } while (false)' brackets.
(SET_MATRIX_ROW_ENABLED_P): Assume 2nd arg is bool.
(PRODUCE_GLYPHS): Simplify use of boolean.
* src/fileio.c (Fcopy_file):
If I is an integer, prefer 'if (I != 0)' to 'if (I)'.
* src/lisp.h (UNGCPRO): Return void, not int.
(FOR_EACH_TAIL): Use void expression, not int expression.
* src/region-cache.c: Reindent.
* src/region-cache.h: Copy comments from region-cache.c, to fix
incorrect remarks about booleans.
2013-12-14 21:36:44 +00:00
|
|
|
server->in_multi = false;
|
|
|
|
server->trash_started = false;
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
if (getok (server))
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* I really shouldn't use the pop_error variable like this, but....
|
|
|
|
*/
|
Avoid some strlen work, primarily via strnlen
* admin/merge-gnulib (GNULIB_MODULES): Add strnlen.
* lib-src/etags.c (find_entries):
* src/emacs.c (main):
* src/nsmenu.m (parseKeyEquiv:):
* src/nsterm.m (ns_xlfd_to_fontname):
* src/term.c (vfatal):
Prefer !*X to !strlen (X).
* lib-src/etags.c (pfnote, add_regex):
* lib-src/pop.c (pop_open):
* lib-src/update-game-score.c (main):
* lwlib/lwlib.c (lw_separator_p):
* src/doprnt.c (doprnt):
* src/emacs.c (main):
* src/inotify.c (inotifyevent_to_event):
* src/keyboard.c (menu_separator_name_p, parse_tool_bar_item):
* src/sysdep.c (get_current_dir_name_or_unreachable):
* src/xdisp.c (store_mode_line_string):
Use strnlen to avoid unnecessary work with strlen.
* lib-src/etags.c (Prolog_functions, prolog_pr)
(Erlang_functions, erlang_func):
Prefer ptrdiff_t to size_t when either will do.
(prolog_pr, erlang_func): New arg LASTLEN, to avoid
unnecessary strlen call. All callers changed.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/strnlen.c, m4/strnlen.m4: New files, copied from Gnulib.
* lwlib/lwlib.c (lw_separator_p):
* src/json.c (json_has_prefix):
Use strncmp to avoid unecessary work with strlen + memcmp.
* src/process.c (set_socket_option): Use SBYTES instead of strlen.
2019-06-25 21:53:39 +00:00
|
|
|
if (strnlen (username, ERROR_MAX - 6 + 1) == ERROR_MAX - 6 + 1)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
pop_close (server);
|
|
|
|
strcpy (pop_error,
|
|
|
|
"Username too long; recompile pop.c with larger ERROR_MAX");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
sprintf (pop_error, "USER %s", username);
|
|
|
|
|
|
|
|
if (sendline (server, pop_error) || getok (server))
|
|
|
|
{
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
Avoid some strlen work, primarily via strnlen
* admin/merge-gnulib (GNULIB_MODULES): Add strnlen.
* lib-src/etags.c (find_entries):
* src/emacs.c (main):
* src/nsmenu.m (parseKeyEquiv:):
* src/nsterm.m (ns_xlfd_to_fontname):
* src/term.c (vfatal):
Prefer !*X to !strlen (X).
* lib-src/etags.c (pfnote, add_regex):
* lib-src/pop.c (pop_open):
* lib-src/update-game-score.c (main):
* lwlib/lwlib.c (lw_separator_p):
* src/doprnt.c (doprnt):
* src/emacs.c (main):
* src/inotify.c (inotifyevent_to_event):
* src/keyboard.c (menu_separator_name_p, parse_tool_bar_item):
* src/sysdep.c (get_current_dir_name_or_unreachable):
* src/xdisp.c (store_mode_line_string):
Use strnlen to avoid unnecessary work with strlen.
* lib-src/etags.c (Prolog_functions, prolog_pr)
(Erlang_functions, erlang_func):
Prefer ptrdiff_t to size_t when either will do.
(prolog_pr, erlang_func): New arg LASTLEN, to avoid
unnecessary strlen call. All callers changed.
* lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
* lib/strnlen.c, m4/strnlen.m4: New files, copied from Gnulib.
* lwlib/lwlib.c (lw_separator_p):
* src/json.c (json_has_prefix):
Use strncmp to avoid unecessary work with strlen + memcmp.
* src/process.c (set_socket_option): Use SBYTES instead of strlen.
2019-06-25 21:53:39 +00:00
|
|
|
if (strnlen (password, ERROR_MAX - 6 + 1) == ERROR_MAX - 6 + 1)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
pop_close (server);
|
|
|
|
strcpy (pop_error,
|
|
|
|
"Password too long; recompile pop.c with larger ERROR_MAX");
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
sprintf (pop_error, "PASS %s", password);
|
|
|
|
|
|
|
|
if (sendline (server, pop_error) || getok (server))
|
|
|
|
{
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (server);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: pop_stat
|
|
|
|
*
|
|
|
|
* Purpose: Issue the STAT command to the server and return (in the
|
|
|
|
* value parameters) the number of messages in the maildrop and
|
|
|
|
* the total size of the maildrop.
|
|
|
|
*
|
|
|
|
* Return value: 0 on success, or non-zero with an error in pop_error
|
|
|
|
* in failure.
|
|
|
|
*
|
|
|
|
* Side effects: On failure, may make further operations on the
|
|
|
|
* connection impossible.
|
|
|
|
*/
|
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_stat (popserver server, int *count, int *size)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
char *fromserver;
|
2008-01-10 15:33:52 +00:00
|
|
|
char *end_ptr;
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
if (server->in_multi)
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "In multi-line query in pop_stat");
|
|
|
|
return (-1);
|
|
|
|
}
|
2001-12-30 22:09:01 +00:00
|
|
|
|
1998-03-26 22:52:21 +00:00
|
|
|
if (sendline (server, "STAT") || (pop_getline (server, &fromserver) < 0))
|
1994-09-27 19:49:25 +00:00
|
|
|
return (-1);
|
|
|
|
|
|
|
|
if (strncmp (fromserver, "+OK ", 4))
|
|
|
|
{
|
|
|
|
if (0 == strncmp (fromserver, "-ERR", 4))
|
2012-07-10 21:48:34 +00:00
|
|
|
snprintf (pop_error, ERROR_MAX, "%s", fromserver);
|
1994-09-27 19:49:25 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy (pop_error,
|
|
|
|
"Unexpected response from POP server in pop_stat");
|
|
|
|
pop_trash (server);
|
|
|
|
}
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
2008-01-10 15:33:52 +00:00
|
|
|
errno = 0;
|
|
|
|
*count = strtol (&fromserver[4], &end_ptr, 10);
|
|
|
|
/* Check validity of string-to-integer conversion. */
|
2008-01-22 15:38:49 +00:00
|
|
|
if (fromserver + 4 == end_ptr || *end_ptr != ' ' || errno)
|
2008-01-10 15:33:52 +00:00
|
|
|
{
|
|
|
|
strcpy (pop_error, "Unexpected response from POP server in pop_stat");
|
|
|
|
pop_trash (server);
|
|
|
|
return (-1);
|
|
|
|
}
|
2001-12-30 22:09:01 +00:00
|
|
|
|
2008-01-22 15:38:49 +00:00
|
|
|
fromserver = end_ptr;
|
1994-09-27 19:49:25 +00:00
|
|
|
|
2008-01-10 15:33:52 +00:00
|
|
|
errno = 0;
|
|
|
|
*size = strtol (fromserver + 1, &end_ptr, 10);
|
2008-01-22 15:38:49 +00:00
|
|
|
if (fromserver + 1 == end_ptr || errno)
|
2008-01-10 15:33:52 +00:00
|
|
|
{
|
|
|
|
strcpy (pop_error, "Unexpected response from POP server in pop_stat");
|
|
|
|
pop_trash (server);
|
|
|
|
return (-1);
|
|
|
|
}
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: pop_list
|
|
|
|
*
|
|
|
|
* Purpose: Performs the POP "list" command and returns (in value
|
|
|
|
* parameters) two malloc'd zero-terminated arrays -- one of
|
|
|
|
* message IDs, and a parallel one of sizes.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* server The pop connection to talk to.
|
|
|
|
* message The number of the one message about which to get
|
|
|
|
* information, or 0 to get information about all
|
|
|
|
* messages.
|
|
|
|
*
|
|
|
|
* Return value: 0 on success, non-zero with error in pop_error on
|
|
|
|
* failure.
|
|
|
|
*
|
|
|
|
* Side effects: On failure, may make further operations on the
|
|
|
|
* connection impossible.
|
|
|
|
*/
|
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_list (popserver server, int message, int **IDs, int **sizes)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
int how_many, i;
|
|
|
|
char *fromserver;
|
|
|
|
|
|
|
|
if (server->in_multi)
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "In multi-line query in pop_list");
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (message)
|
|
|
|
how_many = 1;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int count, size;
|
|
|
|
if (pop_stat (server, &count, &size))
|
|
|
|
return (-1);
|
|
|
|
how_many = count;
|
|
|
|
}
|
|
|
|
|
|
|
|
*IDs = (int *) malloc ((how_many + 1) * sizeof (int));
|
|
|
|
*sizes = (int *) malloc ((how_many + 1) * sizeof (int));
|
|
|
|
if (! (*IDs && *sizes))
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "Out of memory in pop_list");
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (message)
|
|
|
|
{
|
|
|
|
sprintf (pop_error, "LIST %d", message);
|
|
|
|
if (sendline (server, pop_error))
|
|
|
|
{
|
|
|
|
free ((char *) *IDs);
|
|
|
|
free ((char *) *sizes);
|
|
|
|
return (-1);
|
|
|
|
}
|
1998-03-26 22:52:21 +00:00
|
|
|
if (pop_getline (server, &fromserver) < 0)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
free ((char *) *IDs);
|
|
|
|
free ((char *) *sizes);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
if (strncmp (fromserver, "+OK ", 4))
|
|
|
|
{
|
|
|
|
if (! strncmp (fromserver, "-ERR", 4))
|
2012-07-10 21:48:34 +00:00
|
|
|
snprintf (pop_error, ERROR_MAX, "%s", fromserver);
|
1994-09-27 19:49:25 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy (pop_error,
|
|
|
|
"Unexpected response from server in pop_list");
|
|
|
|
pop_trash (server);
|
|
|
|
}
|
|
|
|
free ((char *) *IDs);
|
|
|
|
free ((char *) *sizes);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
(*IDs)[0] = atoi (&fromserver[4]);
|
Use strchr, strrchr instead of index, rindex
* callint.c (Fcall_interactively): Use strchr, strrchr instead of
index, rindex.
* doc.c (get_doc_string, Fsnarf_documentation): Likewise.
* editfns.c (Fuser_full_name, Fformat): Likewise.
* emacs.c (argmatch, sort_args, decode_env_path): Likewise.
* fileio.c (Ffile_symlink_p): Likewise.
* filelock.c (current_lock_owner): Likewise.
* font.c (font_parse_name, font_parse_family_registry): Likewise.
* fontset.c (fontset_pattern_regexp): Likewise.
* lread.c (read1): Likewise.
* sysdep.c (init_system_name): Likewise.
* xfns.c (select_visual): Likewise.
* s/hpux10-20.h (index, rindex): Don't define.
* s/ms-w32.h (index): Likewise.
* s/usg5-4.h: Likewise.
* sed2v2.inp (HAVE_INDEX, HAVE_RINDEX): Don't edit.
(HAVE_STRCHR, HAVE_STRRCHR): Edit to 1.
* emacsclient.c (set_local_socket): Use strchr, strrchr instead of
index, rindex.
* movemail.c (mail_spool_name, popmail): Likewise.
* pop.c (pop_list): Likewise.
* CPP-DEFINES (HAVE_INDEX, HAVE_RINDEX): Remove.
* configure.in: Don't check for index and rindex, check for strchr
and strrchr. Define strchr and strrchr as index and rindex,
resp., in src/config.h if not available.
2010-07-11 10:31:10 +00:00
|
|
|
fromserver = strchr (&fromserver[4], ' ');
|
1994-09-27 19:49:25 +00:00
|
|
|
if (! fromserver)
|
|
|
|
{
|
|
|
|
strcpy (pop_error,
|
|
|
|
"Badly formatted response from server in pop_list");
|
|
|
|
pop_trash (server);
|
|
|
|
free ((char *) *IDs);
|
|
|
|
free ((char *) *sizes);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
(*sizes)[0] = atoi (fromserver);
|
|
|
|
(*IDs)[1] = (*sizes)[1] = 0;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (pop_multi_first (server, "LIST", &fromserver))
|
|
|
|
{
|
|
|
|
free ((char *) *IDs);
|
|
|
|
free ((char *) *sizes);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
for (i = 0; i < how_many; i++)
|
|
|
|
{
|
1997-12-04 06:44:56 +00:00
|
|
|
if (pop_multi_next (server, &fromserver) <= 0)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
free ((char *) *IDs);
|
|
|
|
free ((char *) *sizes);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
(*IDs)[i] = atoi (fromserver);
|
Use strchr, strrchr instead of index, rindex
* callint.c (Fcall_interactively): Use strchr, strrchr instead of
index, rindex.
* doc.c (get_doc_string, Fsnarf_documentation): Likewise.
* editfns.c (Fuser_full_name, Fformat): Likewise.
* emacs.c (argmatch, sort_args, decode_env_path): Likewise.
* fileio.c (Ffile_symlink_p): Likewise.
* filelock.c (current_lock_owner): Likewise.
* font.c (font_parse_name, font_parse_family_registry): Likewise.
* fontset.c (fontset_pattern_regexp): Likewise.
* lread.c (read1): Likewise.
* sysdep.c (init_system_name): Likewise.
* xfns.c (select_visual): Likewise.
* s/hpux10-20.h (index, rindex): Don't define.
* s/ms-w32.h (index): Likewise.
* s/usg5-4.h: Likewise.
* sed2v2.inp (HAVE_INDEX, HAVE_RINDEX): Don't edit.
(HAVE_STRCHR, HAVE_STRRCHR): Edit to 1.
* emacsclient.c (set_local_socket): Use strchr, strrchr instead of
index, rindex.
* movemail.c (mail_spool_name, popmail): Likewise.
* pop.c (pop_list): Likewise.
* CPP-DEFINES (HAVE_INDEX, HAVE_RINDEX): Remove.
* configure.in: Don't check for index and rindex, check for strchr
and strrchr. Define strchr and strrchr as index and rindex,
resp., in src/config.h if not available.
2010-07-11 10:31:10 +00:00
|
|
|
fromserver = strchr (fromserver, ' ');
|
1994-09-27 19:49:25 +00:00
|
|
|
if (! fromserver)
|
|
|
|
{
|
|
|
|
strcpy (pop_error,
|
|
|
|
"Badly formatted response from server in pop_list");
|
|
|
|
free ((char *) *IDs);
|
|
|
|
free ((char *) *sizes);
|
|
|
|
pop_trash (server);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
(*sizes)[i] = atoi (fromserver);
|
|
|
|
}
|
1997-12-04 06:44:56 +00:00
|
|
|
if (pop_multi_next (server, &fromserver) < 0)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
free ((char *) *IDs);
|
|
|
|
free ((char *) *sizes);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
else if (fromserver)
|
|
|
|
{
|
|
|
|
strcpy (pop_error,
|
|
|
|
"Too many response lines from server in pop_list");
|
|
|
|
free ((char *) *IDs);
|
|
|
|
free ((char *) *sizes);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
(*IDs)[i] = (*sizes)[i] = 0;
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: pop_retrieve
|
|
|
|
*
|
|
|
|
* Purpose: Retrieve a specified message from the maildrop.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* server The server to retrieve from.
|
|
|
|
* message The message number to retrieve.
|
|
|
|
* markfrom
|
|
|
|
* If true, then mark the string "From " at the beginning
|
|
|
|
* of lines with '>'.
|
1997-12-04 06:44:56 +00:00
|
|
|
* msg_buf Output parameter to which a buffer containing the
|
|
|
|
* message is assigned.
|
2003-02-04 14:56:31 +00:00
|
|
|
*
|
1997-12-04 06:44:56 +00:00
|
|
|
* Return value: The number of bytes in msg_buf, which may contain
|
|
|
|
* embedded nulls, not including its final null, or -1 on error
|
|
|
|
* with pop_error set.
|
1994-09-27 19:49:25 +00:00
|
|
|
*
|
|
|
|
* Side effects: May kill connection on error.
|
|
|
|
*/
|
1997-12-04 06:44:56 +00:00
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_retrieve (popserver server, int message, int markfrom, char **msg_buf)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
int *IDs, *sizes, bufsize, fromcount = 0, cp = 0;
|
|
|
|
char *ptr, *fromserver;
|
|
|
|
int ret;
|
|
|
|
|
|
|
|
if (server->in_multi)
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "In multi-line query in pop_retrieve");
|
1997-12-04 06:44:56 +00:00
|
|
|
return (-1);
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pop_list (server, message, &IDs, &sizes))
|
1997-12-04 06:44:56 +00:00
|
|
|
return (-1);
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
if (pop_retrieve_first (server, message, &fromserver))
|
|
|
|
{
|
1997-12-04 06:44:56 +00:00
|
|
|
return (-1);
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The "5" below is an arbitrary constant -- I assume that if
|
|
|
|
* there are "From" lines in the text to be marked, there
|
|
|
|
* probably won't be more than 5 of them. If there are, I
|
|
|
|
* allocate more space for them below.
|
|
|
|
*/
|
|
|
|
bufsize = sizes[0] + (markfrom ? 5 : 0);
|
1996-01-20 20:51:31 +00:00
|
|
|
ptr = (char *)malloc (bufsize);
|
1994-09-27 19:49:25 +00:00
|
|
|
free ((char *) IDs);
|
|
|
|
free ((char *) sizes);
|
|
|
|
|
|
|
|
if (! ptr)
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "Out of memory in pop_retrieve");
|
|
|
|
pop_retrieve_flush (server);
|
1997-12-04 06:44:56 +00:00
|
|
|
return (-1);
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
|
1997-12-04 06:44:56 +00:00
|
|
|
while ((ret = pop_retrieve_next (server, &fromserver)) >= 0)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
if (! fromserver)
|
|
|
|
{
|
|
|
|
ptr[cp] = '\0';
|
1997-12-04 06:44:56 +00:00
|
|
|
*msg_buf = ptr;
|
|
|
|
return (cp);
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
if (markfrom && fromserver[0] == 'F' && fromserver[1] == 'r' &&
|
|
|
|
fromserver[2] == 'o' && fromserver[3] == 'm' &&
|
|
|
|
fromserver[4] == ' ')
|
|
|
|
{
|
|
|
|
if (++fromcount == 5)
|
|
|
|
{
|
|
|
|
bufsize += 5;
|
1996-01-20 20:51:31 +00:00
|
|
|
ptr = (char *)realloc (ptr, bufsize);
|
1994-09-27 19:49:25 +00:00
|
|
|
if (! ptr)
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "Out of memory in pop_retrieve");
|
|
|
|
pop_retrieve_flush (server);
|
1997-12-04 06:44:56 +00:00
|
|
|
return (-1);
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
fromcount = 0;
|
|
|
|
}
|
|
|
|
ptr[cp++] = '>';
|
|
|
|
}
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-07 22:18:28 +00:00
|
|
|
memcpy (&ptr[cp], fromserver, ret);
|
1997-12-04 06:44:56 +00:00
|
|
|
cp += ret;
|
1994-09-27 19:49:25 +00:00
|
|
|
ptr[cp++] = '\n';
|
|
|
|
}
|
|
|
|
|
1997-12-04 06:44:56 +00:00
|
|
|
free (ptr);
|
|
|
|
return (-1);
|
2003-02-04 14:56:31 +00:00
|
|
|
}
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_retrieve_first (popserver server, int message, char **response)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
sprintf (pop_error, "RETR %d", message);
|
|
|
|
return (pop_multi_first (server, pop_error, response));
|
|
|
|
}
|
|
|
|
|
1997-12-04 06:44:56 +00:00
|
|
|
/*
|
|
|
|
Returns a negative number on error, 0 to indicate that the data has
|
|
|
|
all been read (i.e., the server has returned a "." termination
|
|
|
|
line), or a positive number indicating the number of bytes in the
|
|
|
|
returned buffer (which is null-terminated and may contain embedded
|
|
|
|
nulls, but the returned bytecount doesn't include the final null).
|
|
|
|
*/
|
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_retrieve_next (popserver server, char **line)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
return (pop_multi_next (server, line));
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_retrieve_flush (popserver server)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
return (pop_multi_flush (server));
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_top_first (popserver server, int message, int lines, char **response)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
sprintf (pop_error, "TOP %d %d", message, lines);
|
|
|
|
return (pop_multi_first (server, pop_error, response));
|
|
|
|
}
|
|
|
|
|
1997-12-04 06:44:56 +00:00
|
|
|
/*
|
|
|
|
Returns a negative number on error, 0 to indicate that the data has
|
|
|
|
all been read (i.e., the server has returned a "." termination
|
|
|
|
line), or a positive number indicating the number of bytes in the
|
|
|
|
returned buffer (which is null-terminated and may contain embedded
|
|
|
|
nulls, but the returned bytecount doesn't include the final null).
|
|
|
|
*/
|
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_top_next (popserver server, char **line)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
return (pop_multi_next (server, line));
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_top_flush (popserver server)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
return (pop_multi_flush (server));
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
pop_multi_first (popserver server, const char *command, char **response)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
if (server->in_multi)
|
|
|
|
{
|
|
|
|
strcpy (pop_error,
|
|
|
|
"Already in multi-line query in pop_multi_first");
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
1998-03-26 22:52:21 +00:00
|
|
|
if (sendline (server, command) || (pop_getline (server, response) < 0))
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (0 == strncmp (*response, "-ERR", 4))
|
|
|
|
{
|
2012-07-10 21:48:34 +00:00
|
|
|
snprintf (pop_error, ERROR_MAX, "%s", *response);
|
1994-09-27 19:49:25 +00:00
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
else if (0 == strncmp (*response, "+OK", 3))
|
|
|
|
{
|
|
|
|
for (*response += 3; **response == ' '; (*response)++) /* empty */;
|
Use bool for boolean, focusing on headers.
* configure.ac (PTY_OPEN, GC_MARK_SECONDARY_STACK):
Use bool for boolean.
* lib-src/emacsclient.c, lib-src/etags.c, lib-src/hexl.c (FALSE, TRUE):
Remove. All uses replaced with uncapitalized version.
* lib-src/emacsclient.c (message):
* lib-src/etags.c (make_tag, pfnote, consider_token, make_C_tag, lang_names):
* lib-src/hexl.c (un_flag, iso_flag, endian):
* lib-src/pop.c (pop_debug, pop_open, pop_multi_first, pop_multi_next)
(pop_trash):
Use bool for boolean.
* lib-src/etags.c (bool): Remove.
* lib-src/etags.c (globals, members, declarations, no_line_directive)
(no_duplicates): Use 'int' for boolean values that getopt requires
to be 'int'. Formerly, these were 'bool' and 'bool' was 'int',
but we can no longer rely on this implementation.
* lib-src/pop.h (struct _popserver): Use bool_bf for boolean bit-fields.
* lwlib/xlwmenuP.h (XlwMenu_part): Use bool_bf for boolean bit-fields.
* src/atimer.h, src/lisp.h, src/syssignal.h, src/syswait.h, src/unexelf.c:
No need to include <stdbool.h>, since conf_post.h does it now.
* src/buffer.h (BUF_COMPUTE_UNCHANGED, DECODE_POSITION)
(BUFFER_CHECK_INDIRECTION, GET_OVERLAYS_AT, PER_BUFFER_VALUE_P)
(SET_PER_BUFFER_VALUE_P):
* src/ccl.c, src/ccl.h (setup_ccl_program):
* src/ccl.h (CHECK_CCL_PROGRAM):
* src/character.h (MAKE_CHAR_UNIBYTE, CHECK_CHARACTER_CAR)
(CHECK_CHARACTER_CDR, CHAR_STRING_ADVANCE, NEXT_CHAR_BOUNDARY)
(PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE)
(FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE)
(FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE)
(FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH)
(DEC_BOTH, BUF_INC_POS, BUF_DEC_POS):
* src/charset.h (CHECK_CHARSET, CHECK_CHARSET_GET_ID)
(CHECK_CHARSET_GET_ATTR, CHECK_CHARSET_GET_CHARSET)
(CHARSET_FAST_MAP_SET):
* src/coding.c (decode_coding_ccl, encode_coding_ccl):
* src/coding.h (CHECK_CODING_SYSTEM, CHECK_CODING_SYSTEM_GET_SPEC)
(CHECK_CODING_SYSTEM_GET_ID, SJIS_TO_JIS, SJIS_TO_JIS2)
(JIS_TO_SJIS, JIS_TO_SJIS2, ENCODE_FILE, DECODE_FILE)
(ENCODE_SYSTEM, DECODE_SYSTEM, ENCODE_UTF_8)
(decode_coding_c_string):
* src/composite.h (COMPOSITION_DECODE_REFS, COMPOSITION_DECODE_RULE):
* src/conf_post.h (has_attribute):
* src/dispextern.h (trace_redisplay_p):
(INC_TEXT_POS, DEC_TEXT_POS, SET_GLYPH_FROM_GLYPH_CODE)
(SET_CHAR_GLYPH, SET_CHAR_GLYPH_FROM_GLYPH)
(SET_GLYPH_FROM_CHAR_GLYPH):
(WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P)
(FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_SUITABLE_FOR_CHAR_P)
(PRODUCE_GLYPHS, reset_mouse_highlight, in_display_vector_p)
(cursor_in_mouse_face_p):
* src/dispnew.c (adjust_glyph_matrix, clear_glyph_matrix_rows)
(blank_row, prepare_desired_row)
(build_frame_matrix_from_leaf_window, make_current)
(mirror_make_current, mirrored_line_dance, mirror_line_dance)
(update_window, scrolling_window, update_frame_line):
* src/disptab.h (GLYPH_FOLLOW_ALIASES):
* src/editfns.c (Fformat):
* src/font.h (FONT_WEIGHT_SYMBOLIC, FONT_SLANT_SYMBOLIC)
(FONT_WIDTH_SYMBOLIC, FONT_WEIGHT_FOR_FACE, FONT_SLANT_FOR_FACE)
(FONT_WIDTH_FOR_FACE, FONT_WEIGHT_NAME_NUMERIC)
(FONT_SLANT_NAME_NUMERIC, FONT_WIDTH_NAME_NUMERIC)
(FONT_SET_STYLE, CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY)
(CHECK_FONT_OBJECT, CHECK_FONT_GET_OBJECT, FONT_ADD_LOG)
(FONT_DEFERRED_LOG):
* src/frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_WINDOW_P):
(FRAME_EXTERNAL_TOOL_BAR, FRAME_EXTERNAL_MENU_BAR, FOR_EACH_FRAME)
(FRAME_MOUSE_UPDATE):
* src/fringe.c (Fdefine_fringe_bitmap):
* src/image.c (x_create_bitmap_from_data, x_create_bitmap_mask)
(x_create_bitmap_from_xpm_data, xpm_load_image):
* src/intervals.h (INTERVAL_HAS_PARENT, INTERVAL_PARENT)
(set_interval_parent, RESET_INTERVAL, COPY_INTERVAL_CACHE)
(MERGE_INTERVAL_CACHE):
* src/keymap.h (KEYMAPP):
* src/lisp.h (eassert, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE)
(STRING_SET_UNIBYTE, STRING_SET_MULTIBYTE, DEFSYM, PSEUDOVECTORP)
(CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER)
(CHECK_NUMBER_COERCE_MARKER, CHECK_NUMBER_OR_FLOAT_COERCE_MARKER)
(DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT)
(DEFVAR_BUFFER_DEFAULTS, DEFVAR_KBOARD, QUIT)
(RETURN_UNGCPRO, USE_SAFE_ALLOCA, SAFE_NALLOCA, SAFE_FREE)
(SAFE_ALLOCA_LISP, FOR_EACH_ALIST_VALUE, functionp):
* src/syntax.h (SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX)
(UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD)
(SETUP_BUFFER_SYNTAX_TABLE):
* src/systime.h (timespec_valid_p):
* src/term.c (save_and_enable_current_matrix):
* src/window.h (WINDOW_MENU_BAR_P, WINDOW_TOOL_BAR_P):
* src/xdisp.c (in_display_vector_p, display_tool_bar_line)
(redisplay_internal, try_window_reusing_current_matrix)
(sync_frame_with_window_matrix_rows, try_window_id)
(display_menu_bar, display_tty_menu_item, display_mode_line)
(coords_in_mouse_face_p, cursor_in_mouse_face_p):
* src/xmenu.c (xmenu_show):
* src/xterm.c (use_xim, x_term_init):
* src/xterm.h (XSync, GTK_CHECK_VERSION, use_xim, SET_SCROLL_BAR_X_WIDGET)
(struct x_bitmap_record):
Use bool for booleans.
* src/ccl.c (struct buffer_text):
* src/ccl.h (struct ccl_program):
* src/charset.h (struct charset):
* src/cm.h (struct cm):
* src/coding.h (struct iso_2022_spec, struct coding_system):
* src/dispextern.h (struct glyph, struct glyph_matrix, struct glyph_row)
(struct glyph_string, struct face, struct face_cache)
(struct bidi_string_data, struct bidi_it)
(struct draw_fringe_bitmap_params, struct it, Mouse_HLInfo)
(struct image):
* src/editfns.c (Fformat):
* src/frame.h (struct frame):
* src/fringe.c (struct fringe_bitmap):
* src/intervals.h (struct interval):
* src/keyboard.h (struct kboard):
* src/lisp.h (struct Lisp_Symbol, struct Lisp_Misc_Any, struct Lisp_Marker)
(struct Lisp_Overlay, struct Lisp_Save_Value, struct Lisp_Free)
(struct Lisp_Buffer_Local_Value, union specbinding):
* src/macfont.m (struct macfont_info):
* src/process.h (struct Lisp_Process):
* src/termchar.h (struct tty_display_info):
* src/window.h (struct window):
* src/xterm.h (struct x_output):
Use bool_bf for boolean bit-fields.
* src/ccl.c (setup_ccl_program): Now returns bool instead of -1 or 0.
All callers changed.
* src/ccl.h (struct ccl_program): Remove unused members private_state,
src_multibyte, dst_multibyte, cr_consumed, suppress_error,
eight_bit_control.
(struct ccl_spec): Remove unused members cr_carryover,
eight_bit_carryover.
* src/conf_post.h: Include <stdbool.h>.
(bool_bf): New type.
* src/dispextern.h (TRACE, PREPARE_FACE_FOR_DISPLAY):
* src/interval.h (RESET_INTERVAL, COPY_INTERVAL_CACHE, MERGE_INTERVAL_CACHE)
Surround statement macro with proper 'do { ... } while (false)' brackets.
(SET_MATRIX_ROW_ENABLED_P): Assume 2nd arg is bool.
(PRODUCE_GLYPHS): Simplify use of boolean.
* src/fileio.c (Fcopy_file):
If I is an integer, prefer 'if (I != 0)' to 'if (I)'.
* src/lisp.h (UNGCPRO): Return void, not int.
(FOR_EACH_TAIL): Use void expression, not int expression.
* src/region-cache.c: Reindent.
* src/region-cache.h: Copy comments from region-cache.c, to fix
incorrect remarks about booleans.
2013-12-14 21:36:44 +00:00
|
|
|
server->in_multi = true;
|
1994-09-27 19:49:25 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy (pop_error,
|
|
|
|
"Unexpected response from server in pop_multi_first");
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-12-04 06:44:56 +00:00
|
|
|
/*
|
|
|
|
Read the next line of data from SERVER and place a pointer to it
|
|
|
|
into LINE. Return -1 on error, 0 if there are no more lines to read
|
|
|
|
(i.e., the server has returned a line containing only "."), or a
|
|
|
|
positive number indicating the number of bytes in the LINE buffer
|
|
|
|
(not including the final null). The data in that buffer may contain
|
|
|
|
embedded nulls, but does not contain the final CRLF. When returning
|
|
|
|
0, LINE is set to null. */
|
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_multi_next (popserver server, char **line)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
char *fromserver;
|
1997-12-04 06:44:56 +00:00
|
|
|
int ret;
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
if (! server->in_multi)
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "Not in multi-line query in pop_multi_next");
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
2016-08-28 08:56:51 +00:00
|
|
|
ret = pop_getline (server, &fromserver);
|
|
|
|
if (ret < 0)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fromserver[0] == '.')
|
|
|
|
{
|
|
|
|
if (! fromserver[1])
|
|
|
|
{
|
|
|
|
*line = 0;
|
Use bool for boolean, focusing on headers.
* configure.ac (PTY_OPEN, GC_MARK_SECONDARY_STACK):
Use bool for boolean.
* lib-src/emacsclient.c, lib-src/etags.c, lib-src/hexl.c (FALSE, TRUE):
Remove. All uses replaced with uncapitalized version.
* lib-src/emacsclient.c (message):
* lib-src/etags.c (make_tag, pfnote, consider_token, make_C_tag, lang_names):
* lib-src/hexl.c (un_flag, iso_flag, endian):
* lib-src/pop.c (pop_debug, pop_open, pop_multi_first, pop_multi_next)
(pop_trash):
Use bool for boolean.
* lib-src/etags.c (bool): Remove.
* lib-src/etags.c (globals, members, declarations, no_line_directive)
(no_duplicates): Use 'int' for boolean values that getopt requires
to be 'int'. Formerly, these were 'bool' and 'bool' was 'int',
but we can no longer rely on this implementation.
* lib-src/pop.h (struct _popserver): Use bool_bf for boolean bit-fields.
* lwlib/xlwmenuP.h (XlwMenu_part): Use bool_bf for boolean bit-fields.
* src/atimer.h, src/lisp.h, src/syssignal.h, src/syswait.h, src/unexelf.c:
No need to include <stdbool.h>, since conf_post.h does it now.
* src/buffer.h (BUF_COMPUTE_UNCHANGED, DECODE_POSITION)
(BUFFER_CHECK_INDIRECTION, GET_OVERLAYS_AT, PER_BUFFER_VALUE_P)
(SET_PER_BUFFER_VALUE_P):
* src/ccl.c, src/ccl.h (setup_ccl_program):
* src/ccl.h (CHECK_CCL_PROGRAM):
* src/character.h (MAKE_CHAR_UNIBYTE, CHECK_CHARACTER_CAR)
(CHECK_CHARACTER_CDR, CHAR_STRING_ADVANCE, NEXT_CHAR_BOUNDARY)
(PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE)
(FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE)
(FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE)
(FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH)
(DEC_BOTH, BUF_INC_POS, BUF_DEC_POS):
* src/charset.h (CHECK_CHARSET, CHECK_CHARSET_GET_ID)
(CHECK_CHARSET_GET_ATTR, CHECK_CHARSET_GET_CHARSET)
(CHARSET_FAST_MAP_SET):
* src/coding.c (decode_coding_ccl, encode_coding_ccl):
* src/coding.h (CHECK_CODING_SYSTEM, CHECK_CODING_SYSTEM_GET_SPEC)
(CHECK_CODING_SYSTEM_GET_ID, SJIS_TO_JIS, SJIS_TO_JIS2)
(JIS_TO_SJIS, JIS_TO_SJIS2, ENCODE_FILE, DECODE_FILE)
(ENCODE_SYSTEM, DECODE_SYSTEM, ENCODE_UTF_8)
(decode_coding_c_string):
* src/composite.h (COMPOSITION_DECODE_REFS, COMPOSITION_DECODE_RULE):
* src/conf_post.h (has_attribute):
* src/dispextern.h (trace_redisplay_p):
(INC_TEXT_POS, DEC_TEXT_POS, SET_GLYPH_FROM_GLYPH_CODE)
(SET_CHAR_GLYPH, SET_CHAR_GLYPH_FROM_GLYPH)
(SET_GLYPH_FROM_CHAR_GLYPH):
(WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P)
(FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_SUITABLE_FOR_CHAR_P)
(PRODUCE_GLYPHS, reset_mouse_highlight, in_display_vector_p)
(cursor_in_mouse_face_p):
* src/dispnew.c (adjust_glyph_matrix, clear_glyph_matrix_rows)
(blank_row, prepare_desired_row)
(build_frame_matrix_from_leaf_window, make_current)
(mirror_make_current, mirrored_line_dance, mirror_line_dance)
(update_window, scrolling_window, update_frame_line):
* src/disptab.h (GLYPH_FOLLOW_ALIASES):
* src/editfns.c (Fformat):
* src/font.h (FONT_WEIGHT_SYMBOLIC, FONT_SLANT_SYMBOLIC)
(FONT_WIDTH_SYMBOLIC, FONT_WEIGHT_FOR_FACE, FONT_SLANT_FOR_FACE)
(FONT_WIDTH_FOR_FACE, FONT_WEIGHT_NAME_NUMERIC)
(FONT_SLANT_NAME_NUMERIC, FONT_WIDTH_NAME_NUMERIC)
(FONT_SET_STYLE, CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY)
(CHECK_FONT_OBJECT, CHECK_FONT_GET_OBJECT, FONT_ADD_LOG)
(FONT_DEFERRED_LOG):
* src/frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_WINDOW_P):
(FRAME_EXTERNAL_TOOL_BAR, FRAME_EXTERNAL_MENU_BAR, FOR_EACH_FRAME)
(FRAME_MOUSE_UPDATE):
* src/fringe.c (Fdefine_fringe_bitmap):
* src/image.c (x_create_bitmap_from_data, x_create_bitmap_mask)
(x_create_bitmap_from_xpm_data, xpm_load_image):
* src/intervals.h (INTERVAL_HAS_PARENT, INTERVAL_PARENT)
(set_interval_parent, RESET_INTERVAL, COPY_INTERVAL_CACHE)
(MERGE_INTERVAL_CACHE):
* src/keymap.h (KEYMAPP):
* src/lisp.h (eassert, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE)
(STRING_SET_UNIBYTE, STRING_SET_MULTIBYTE, DEFSYM, PSEUDOVECTORP)
(CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER)
(CHECK_NUMBER_COERCE_MARKER, CHECK_NUMBER_OR_FLOAT_COERCE_MARKER)
(DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT)
(DEFVAR_BUFFER_DEFAULTS, DEFVAR_KBOARD, QUIT)
(RETURN_UNGCPRO, USE_SAFE_ALLOCA, SAFE_NALLOCA, SAFE_FREE)
(SAFE_ALLOCA_LISP, FOR_EACH_ALIST_VALUE, functionp):
* src/syntax.h (SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX)
(UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD)
(SETUP_BUFFER_SYNTAX_TABLE):
* src/systime.h (timespec_valid_p):
* src/term.c (save_and_enable_current_matrix):
* src/window.h (WINDOW_MENU_BAR_P, WINDOW_TOOL_BAR_P):
* src/xdisp.c (in_display_vector_p, display_tool_bar_line)
(redisplay_internal, try_window_reusing_current_matrix)
(sync_frame_with_window_matrix_rows, try_window_id)
(display_menu_bar, display_tty_menu_item, display_mode_line)
(coords_in_mouse_face_p, cursor_in_mouse_face_p):
* src/xmenu.c (xmenu_show):
* src/xterm.c (use_xim, x_term_init):
* src/xterm.h (XSync, GTK_CHECK_VERSION, use_xim, SET_SCROLL_BAR_X_WIDGET)
(struct x_bitmap_record):
Use bool for booleans.
* src/ccl.c (struct buffer_text):
* src/ccl.h (struct ccl_program):
* src/charset.h (struct charset):
* src/cm.h (struct cm):
* src/coding.h (struct iso_2022_spec, struct coding_system):
* src/dispextern.h (struct glyph, struct glyph_matrix, struct glyph_row)
(struct glyph_string, struct face, struct face_cache)
(struct bidi_string_data, struct bidi_it)
(struct draw_fringe_bitmap_params, struct it, Mouse_HLInfo)
(struct image):
* src/editfns.c (Fformat):
* src/frame.h (struct frame):
* src/fringe.c (struct fringe_bitmap):
* src/intervals.h (struct interval):
* src/keyboard.h (struct kboard):
* src/lisp.h (struct Lisp_Symbol, struct Lisp_Misc_Any, struct Lisp_Marker)
(struct Lisp_Overlay, struct Lisp_Save_Value, struct Lisp_Free)
(struct Lisp_Buffer_Local_Value, union specbinding):
* src/macfont.m (struct macfont_info):
* src/process.h (struct Lisp_Process):
* src/termchar.h (struct tty_display_info):
* src/window.h (struct window):
* src/xterm.h (struct x_output):
Use bool_bf for boolean bit-fields.
* src/ccl.c (setup_ccl_program): Now returns bool instead of -1 or 0.
All callers changed.
* src/ccl.h (struct ccl_program): Remove unused members private_state,
src_multibyte, dst_multibyte, cr_consumed, suppress_error,
eight_bit_control.
(struct ccl_spec): Remove unused members cr_carryover,
eight_bit_carryover.
* src/conf_post.h: Include <stdbool.h>.
(bool_bf): New type.
* src/dispextern.h (TRACE, PREPARE_FACE_FOR_DISPLAY):
* src/interval.h (RESET_INTERVAL, COPY_INTERVAL_CACHE, MERGE_INTERVAL_CACHE)
Surround statement macro with proper 'do { ... } while (false)' brackets.
(SET_MATRIX_ROW_ENABLED_P): Assume 2nd arg is bool.
(PRODUCE_GLYPHS): Simplify use of boolean.
* src/fileio.c (Fcopy_file):
If I is an integer, prefer 'if (I != 0)' to 'if (I)'.
* src/lisp.h (UNGCPRO): Return void, not int.
(FOR_EACH_TAIL): Use void expression, not int expression.
* src/region-cache.c: Reindent.
* src/region-cache.h: Copy comments from region-cache.c, to fix
incorrect remarks about booleans.
2013-12-14 21:36:44 +00:00
|
|
|
server->in_multi = false;
|
1994-09-27 19:49:25 +00:00
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*line = fromserver + 1;
|
1997-12-04 06:44:56 +00:00
|
|
|
return (ret - 1);
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
*line = fromserver;
|
1997-12-04 06:44:56 +00:00
|
|
|
return (ret);
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_multi_flush (popserver server)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
char *line;
|
1997-12-04 06:44:56 +00:00
|
|
|
int ret;
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
if (! server->in_multi)
|
|
|
|
{
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
1997-12-04 06:44:56 +00:00
|
|
|
while ((ret = pop_multi_next (server, &line)))
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
1997-12-04 06:44:56 +00:00
|
|
|
if (ret < 0)
|
|
|
|
return (-1);
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
|
1997-12-04 06:44:56 +00:00
|
|
|
return (0);
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Function: pop_delete
|
|
|
|
*
|
|
|
|
* Purpose: Delete a specified message.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* server Server from which to delete the message.
|
|
|
|
* message Message to delete.
|
|
|
|
*
|
|
|
|
* Return value: 0 on success, non-zero with error in pop_error
|
|
|
|
* otherwise.
|
|
|
|
*/
|
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_delete (popserver server, int message)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
if (server->in_multi)
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "In multi-line query in pop_delete");
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
sprintf (pop_error, "DELE %d", message);
|
|
|
|
|
|
|
|
if (sendline (server, pop_error) || getok (server))
|
|
|
|
return (-1);
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: pop_noop
|
|
|
|
*
|
|
|
|
* Purpose: Send a noop command to the server.
|
|
|
|
*
|
|
|
|
* Argument:
|
|
|
|
* server The server to send to.
|
|
|
|
*
|
|
|
|
* Return value: 0 on success, non-zero with error in pop_error
|
|
|
|
* otherwise.
|
|
|
|
*
|
|
|
|
* Side effects: Closes connection on error.
|
|
|
|
*/
|
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_noop (popserver server)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
if (server->in_multi)
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "In multi-line query in pop_noop");
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sendline (server, "NOOP") || getok (server))
|
|
|
|
return (-1);
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: pop_last
|
|
|
|
*
|
|
|
|
* Purpose: Find out the highest seen message from the server.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* server The server.
|
|
|
|
*
|
|
|
|
* Return value: If successful, the highest seen message, which is
|
|
|
|
* greater than or equal to 0. Otherwise, a negative number with
|
|
|
|
* the error explained in pop_error.
|
|
|
|
*
|
|
|
|
* Side effects: Closes the connection on error.
|
|
|
|
*/
|
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_last (popserver server)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
char *fromserver;
|
2001-12-30 22:09:01 +00:00
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
if (server->in_multi)
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "In multi-line query in pop_last");
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sendline (server, "LAST"))
|
|
|
|
return (-1);
|
|
|
|
|
1998-03-26 22:52:21 +00:00
|
|
|
if (pop_getline (server, &fromserver) < 0)
|
1994-09-27 19:49:25 +00:00
|
|
|
return (-1);
|
|
|
|
|
|
|
|
if (! strncmp (fromserver, "-ERR", 4))
|
|
|
|
{
|
2012-07-10 21:48:34 +00:00
|
|
|
snprintf (pop_error, ERROR_MAX, "%s", fromserver);
|
1994-09-27 19:49:25 +00:00
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
else if (strncmp (fromserver, "+OK ", 4))
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "Unexpected response from server in pop_last");
|
|
|
|
pop_trash (server);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2008-01-10 15:33:52 +00:00
|
|
|
char *end_ptr;
|
|
|
|
int count;
|
|
|
|
errno = 0;
|
|
|
|
count = strtol (&fromserver[4], &end_ptr, 10);
|
2008-01-22 15:38:49 +00:00
|
|
|
if (fromserver + 4 == end_ptr || errno)
|
2008-01-10 15:33:52 +00:00
|
|
|
{
|
|
|
|
strcpy (pop_error, "Unexpected response from server in pop_last");
|
|
|
|
pop_trash (server);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
return count;
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: pop_reset
|
|
|
|
*
|
|
|
|
* Purpose: Reset the server to its initial connect state
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* server The server.
|
|
|
|
*
|
|
|
|
* Return value: 0 for success, non-0 with error in pop_error
|
|
|
|
* otherwise.
|
|
|
|
*
|
|
|
|
* Side effects: Closes the connection on error.
|
|
|
|
*/
|
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_reset (popserver server)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
if (pop_retrieve_flush (server))
|
|
|
|
{
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sendline (server, "RSET") || getok (server))
|
|
|
|
return (-1);
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: pop_quit
|
|
|
|
*
|
|
|
|
* Purpose: Quit the connection to the server,
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* server The server to quit.
|
|
|
|
*
|
|
|
|
* Return value: 0 for success, non-zero otherwise with error in
|
|
|
|
* pop_error.
|
|
|
|
*
|
1996-01-05 10:03:17 +00:00
|
|
|
* Side Effects: The popserver passed in is unusable after this
|
1994-09-27 19:49:25 +00:00
|
|
|
* function is called, even if an error occurs.
|
|
|
|
*/
|
|
|
|
int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_quit (popserver server)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
int ret = 0;
|
|
|
|
|
|
|
|
if (server->file >= 0)
|
|
|
|
{
|
|
|
|
if (pop_retrieve_flush (server))
|
|
|
|
{
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sendline (server, "QUIT") || getok (server))
|
|
|
|
{
|
|
|
|
ret = -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
close (server->file);
|
|
|
|
}
|
|
|
|
|
2008-06-02 06:00:54 +00:00
|
|
|
free (server->buffer);
|
1994-09-27 19:49:25 +00:00
|
|
|
free ((char *) server);
|
|
|
|
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
1996-04-28 19:08:33 +00:00
|
|
|
#ifdef WINDOWSNT
|
|
|
|
static int have_winsock = 0;
|
|
|
|
#endif
|
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
/*
|
|
|
|
* Function: socket_connection
|
|
|
|
*
|
|
|
|
* Purpose: Opens the network connection with the mail host, without
|
|
|
|
* doing any sort of I/O with it or anything.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* host The host to which to connect.
|
|
|
|
* flags Option flags.
|
2001-12-30 22:09:01 +00:00
|
|
|
*
|
1994-09-27 19:49:25 +00:00
|
|
|
* Return value: A file descriptor indicating the connection, or -1
|
|
|
|
* indicating failure, in which case an error has been copied
|
|
|
|
* into pop_error.
|
|
|
|
*/
|
|
|
|
static int
|
2010-07-03 00:50:23 +00:00
|
|
|
socket_connection (char *host, int flags)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
2007-11-18 17:24:37 +00:00
|
|
|
struct addrinfo *res, *it;
|
|
|
|
struct addrinfo hints;
|
|
|
|
int ret;
|
1994-09-27 19:49:25 +00:00
|
|
|
struct servent *servent;
|
|
|
|
struct sockaddr_in addr;
|
|
|
|
char found_port = 0;
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
const char *service;
|
1994-09-27 19:49:25 +00:00
|
|
|
int sock;
|
2007-11-19 11:09:20 +00:00
|
|
|
char *realhost;
|
1994-09-27 19:49:25 +00:00
|
|
|
#ifdef KERBEROS
|
1997-07-28 05:52:35 +00:00
|
|
|
#ifdef KERBEROS5
|
1994-09-27 19:49:25 +00:00
|
|
|
krb5_error_code rem;
|
1997-07-28 05:52:35 +00:00
|
|
|
krb5_context kcontext = 0;
|
|
|
|
krb5_auth_context auth_context = 0;
|
1994-09-27 19:49:25 +00:00
|
|
|
krb5_ccache ccdef;
|
|
|
|
krb5_principal client, server;
|
|
|
|
krb5_error *err_ret;
|
|
|
|
register char *cp;
|
|
|
|
#else
|
|
|
|
KTEXT ticket;
|
|
|
|
MSG_DAT msg_data;
|
|
|
|
CREDENTIALS cred;
|
|
|
|
Key_schedule schedule;
|
|
|
|
int rem;
|
1997-07-28 05:52:35 +00:00
|
|
|
#endif /* KERBEROS5 */
|
1994-09-27 19:49:25 +00:00
|
|
|
#endif /* KERBEROS */
|
|
|
|
|
|
|
|
int try_count = 0;
|
2007-11-18 17:24:37 +00:00
|
|
|
int connect_ok;
|
1994-09-27 19:49:25 +00:00
|
|
|
|
1996-04-28 19:08:33 +00:00
|
|
|
#ifdef WINDOWSNT
|
|
|
|
{
|
|
|
|
WSADATA winsockData;
|
|
|
|
if (WSAStartup (0x101, &winsockData) == 0)
|
|
|
|
have_winsock = 1;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-07 22:18:28 +00:00
|
|
|
memset (&addr, 0, sizeof (addr));
|
1994-09-27 19:49:25 +00:00
|
|
|
addr.sin_family = AF_INET;
|
|
|
|
|
2006-05-23 10:44:39 +00:00
|
|
|
/** "kpop" service is never used: look for 20060515 to see why **/
|
1994-09-27 19:49:25 +00:00
|
|
|
#ifdef KERBEROS
|
|
|
|
service = (flags & POP_NO_KERBEROS) ? POP_SERVICE : KPOP_SERVICE;
|
|
|
|
#else
|
|
|
|
service = POP_SERVICE;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HESIOD
|
|
|
|
if (! (flags & POP_NO_HESIOD))
|
|
|
|
{
|
|
|
|
servent = hes_getservbyname (service, "tcp");
|
|
|
|
if (servent)
|
|
|
|
{
|
|
|
|
addr.sin_port = servent->s_port;
|
|
|
|
found_port = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (! found_port)
|
|
|
|
{
|
|
|
|
servent = getservbyname (service, "tcp");
|
|
|
|
if (servent)
|
|
|
|
{
|
|
|
|
addr.sin_port = servent->s_port;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-05-23 10:44:39 +00:00
|
|
|
/** "kpop" service is never used: look for 20060515 to see why **/
|
1994-09-27 19:49:25 +00:00
|
|
|
#ifdef KERBEROS
|
|
|
|
addr.sin_port = htons ((flags & POP_NO_KERBEROS) ?
|
|
|
|
POP_PORT : KPOP_PORT);
|
|
|
|
#else
|
|
|
|
addr.sin_port = htons (POP_PORT);
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1997-07-28 05:52:35 +00:00
|
|
|
#define POP_SOCKET_ERROR "Could not create socket for POP connection: "
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
sock = socket (PF_INET, SOCK_STREAM, 0);
|
|
|
|
if (sock < 0)
|
|
|
|
{
|
2012-07-10 21:48:34 +00:00
|
|
|
snprintf (pop_error, ERROR_MAX, "%s%s",
|
|
|
|
POP_SOCKET_ERROR, strerror (errno));
|
1994-09-27 19:49:25 +00:00
|
|
|
return (-1);
|
2001-12-30 22:09:01 +00:00
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
|
2011-09-09 01:06:52 +00:00
|
|
|
memset (&hints, 0, sizeof (hints));
|
2007-11-18 17:24:37 +00:00
|
|
|
hints.ai_socktype = SOCK_STREAM;
|
2007-11-27 07:38:21 +00:00
|
|
|
hints.ai_flags = AI_CANONNAME;
|
2007-11-18 17:24:37 +00:00
|
|
|
hints.ai_family = AF_INET;
|
|
|
|
do
|
|
|
|
{
|
|
|
|
ret = getaddrinfo (host, service, &hints, &res);
|
|
|
|
try_count++;
|
|
|
|
if (ret != 0 && (ret != EAI_AGAIN || try_count == 5))
|
|
|
|
{
|
|
|
|
strcpy (pop_error, "Could not determine POP server's address");
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
} while (ret != 0);
|
|
|
|
|
2013-05-18 05:32:17 +00:00
|
|
|
for (it = res; it; it = it->ai_next)
|
|
|
|
if (it->ai_addrlen == sizeof addr)
|
|
|
|
{
|
|
|
|
struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr;
|
|
|
|
addr.sin_addr = in_a->sin_addr;
|
|
|
|
if (! connect (sock, (struct sockaddr *) &addr, sizeof addr))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
connect_ok = it != NULL;
|
|
|
|
if (connect_ok)
|
2007-11-18 17:24:37 +00:00
|
|
|
{
|
2013-05-18 05:32:17 +00:00
|
|
|
realhost = alloca (strlen (it->ai_canonname) + 1);
|
|
|
|
strcpy (realhost, it->ai_canonname);
|
2007-11-18 17:24:37 +00:00
|
|
|
}
|
2013-05-18 05:32:17 +00:00
|
|
|
freeaddrinfo (res);
|
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
#define CONNECT_ERROR "Could not connect to POP server: "
|
2001-12-30 22:09:01 +00:00
|
|
|
|
2007-11-18 17:24:37 +00:00
|
|
|
if (! connect_ok)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
1996-04-29 15:46:17 +00:00
|
|
|
CLOSESOCKET (sock);
|
2012-07-10 21:48:34 +00:00
|
|
|
snprintf (pop_error, ERROR_MAX, "%s%s", CONNECT_ERROR, strerror (errno));
|
1994-09-27 19:49:25 +00:00
|
|
|
return (-1);
|
2001-12-30 22:09:01 +00:00
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef KERBEROS
|
2007-11-18 17:24:37 +00:00
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
#define KRB_ERROR "Kerberos error connecting to POP server: "
|
|
|
|
if (! (flags & POP_NO_KERBEROS))
|
|
|
|
{
|
1997-07-28 05:52:35 +00:00
|
|
|
#ifdef KERBEROS5
|
2016-08-28 08:56:51 +00:00
|
|
|
rem = krb5_init_context (&kcontext);
|
|
|
|
if (rem)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
krb5error:
|
1997-07-28 05:52:35 +00:00
|
|
|
if (auth_context)
|
|
|
|
krb5_auth_con_free (kcontext, auth_context);
|
|
|
|
if (kcontext)
|
|
|
|
krb5_free_context (kcontext);
|
2012-07-10 21:48:34 +00:00
|
|
|
snprintf (pop_error, ERROR_MAX, "%s%s",
|
|
|
|
KRB_ERROR, error_message (rem));
|
1996-04-29 15:46:17 +00:00
|
|
|
CLOSESOCKET (sock);
|
1994-09-27 19:49:25 +00:00
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
2016-08-28 08:56:51 +00:00
|
|
|
rem = krb5_auth_con_init (kcontext, &auth_context);
|
|
|
|
if (rem)
|
1997-07-28 05:52:35 +00:00
|
|
|
goto krb5error;
|
2001-12-30 22:09:01 +00:00
|
|
|
|
2016-08-28 08:56:51 +00:00
|
|
|
rem = krb5_cc_default (kcontext, &ccdef);
|
|
|
|
if (rem)
|
1997-07-28 05:52:35 +00:00
|
|
|
goto krb5error;
|
|
|
|
|
2016-08-28 08:56:51 +00:00
|
|
|
rem = krb5_cc_get_principal (kcontext, ccdef, &client);
|
|
|
|
if (rem)
|
1997-07-28 05:52:35 +00:00
|
|
|
goto krb5error;
|
1994-09-27 19:49:25 +00:00
|
|
|
|
2007-11-18 17:24:37 +00:00
|
|
|
for (cp = realhost; *cp; cp++)
|
2016-08-28 08:56:51 +00:00
|
|
|
*cp = c_tolower (*cp);
|
1994-09-27 19:49:25 +00:00
|
|
|
|
2016-08-28 08:56:51 +00:00
|
|
|
rem = krb5_sname_to_principal (kcontext, realhost,
|
|
|
|
POP_SERVICE, FALSE, &server);
|
|
|
|
if (rem)
|
1997-07-28 05:52:35 +00:00
|
|
|
goto krb5error;
|
1994-09-27 19:49:25 +00:00
|
|
|
|
1997-07-28 05:52:35 +00:00
|
|
|
rem = krb5_sendauth (kcontext, &auth_context,
|
2016-08-28 08:56:51 +00:00
|
|
|
(krb5_pointer) &sock, (char *) "KPOPV1.0",
|
|
|
|
client, server,
|
1994-09-27 19:49:25 +00:00
|
|
|
AP_OPTS_MUTUAL_REQUIRED,
|
|
|
|
0, /* no checksum */
|
|
|
|
0, /* no creds, use ccache instead */
|
|
|
|
ccdef,
|
|
|
|
&err_ret,
|
1997-07-28 05:52:35 +00:00
|
|
|
0, /* don't need subsession key */
|
1994-09-27 19:49:25 +00:00
|
|
|
0); /* don't need reply */
|
1997-07-28 05:52:35 +00:00
|
|
|
krb5_free_principal (kcontext, server);
|
1994-09-27 19:49:25 +00:00
|
|
|
if (rem)
|
|
|
|
{
|
2012-07-10 21:48:34 +00:00
|
|
|
int pop_error_len = snprintf (pop_error, ERROR_MAX, "%s%s",
|
|
|
|
KRB_ERROR, error_message (rem));
|
2008-08-05 23:44:48 +00:00
|
|
|
#if defined HAVE_KRB5_ERROR_TEXT
|
1994-09-27 19:49:25 +00:00
|
|
|
if (err_ret && err_ret->text.length)
|
|
|
|
{
|
2012-07-10 21:48:34 +00:00
|
|
|
int errlen = err_ret->text.length;
|
|
|
|
snprintf (pop_error + pop_error_len, ERROR_MAX - pop_error_len,
|
2016-02-27 13:19:06 +00:00
|
|
|
" [server says '%.*s']", errlen, err_ret->text.data);
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
2008-08-05 23:44:48 +00:00
|
|
|
#elif defined HAVE_KRB5_ERROR_E_TEXT
|
2012-07-10 21:48:34 +00:00
|
|
|
if (err_ret && err_ret->e_text && **err_ret->e_text)
|
2013-03-12 22:00:07 +00:00
|
|
|
snprintf (pop_error + pop_error_len, ERROR_MAX - pop_error_len,
|
2012-07-10 21:48:34 +00:00
|
|
|
" [server says '%s']", *err_ret->e_text);
|
2008-08-05 23:44:48 +00:00
|
|
|
#endif
|
1994-09-27 19:49:25 +00:00
|
|
|
if (err_ret)
|
1997-07-28 05:52:35 +00:00
|
|
|
krb5_free_error (kcontext, err_ret);
|
|
|
|
krb5_auth_con_free (kcontext, auth_context);
|
|
|
|
krb5_free_context (kcontext);
|
1994-09-27 19:49:25 +00:00
|
|
|
|
1996-04-29 15:46:17 +00:00
|
|
|
CLOSESOCKET (sock);
|
1994-09-27 19:49:25 +00:00
|
|
|
return (-1);
|
|
|
|
}
|
2001-12-30 22:09:01 +00:00
|
|
|
#else /* ! KERBEROS5 */
|
1994-09-27 19:49:25 +00:00
|
|
|
ticket = (KTEXT) malloc (sizeof (KTEXT_ST));
|
1996-11-21 20:47:59 +00:00
|
|
|
rem = krb_sendauth (0L, sock, ticket, "pop", realhost,
|
|
|
|
(char *) krb_realmofhost (realhost),
|
1994-09-27 19:49:25 +00:00
|
|
|
(unsigned long) 0, &msg_data, &cred, schedule,
|
|
|
|
(struct sockaddr_in *) 0,
|
|
|
|
(struct sockaddr_in *) 0,
|
|
|
|
"KPOPV0.1");
|
|
|
|
free ((char *) ticket);
|
|
|
|
if (rem != KSUCCESS)
|
|
|
|
{
|
2012-07-10 21:48:34 +00:00
|
|
|
snprintf (pop_error, ERROR_MAX, "%s%s", KRB_ERROR, krb_err_txt[rem]);
|
1996-04-29 15:46:17 +00:00
|
|
|
CLOSESOCKET (sock);
|
1994-09-27 19:49:25 +00:00
|
|
|
return (-1);
|
|
|
|
}
|
1997-07-28 05:52:35 +00:00
|
|
|
#endif /* KERBEROS5 */
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
#endif /* KERBEROS */
|
|
|
|
|
|
|
|
return (sock);
|
|
|
|
} /* socket_connection */
|
|
|
|
|
|
|
|
/*
|
1998-03-26 22:52:21 +00:00
|
|
|
* Function: pop_getline
|
1994-09-27 19:49:25 +00:00
|
|
|
*
|
|
|
|
* Purpose: Get a line of text from the connection and return a
|
|
|
|
* pointer to it. The carriage return and linefeed at the end of
|
|
|
|
* the line are stripped, but periods at the beginnings of lines
|
|
|
|
* are NOT dealt with in any special way.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* server The server from which to get the line of text.
|
|
|
|
*
|
1997-12-04 06:44:56 +00:00
|
|
|
* Returns: The number of characters in the line, which is returned in
|
|
|
|
* LINE, not including the final null. A return value of 0
|
|
|
|
* indicates a blank line. A negative return value indicates an
|
|
|
|
* error (in which case the contents of LINE are undefined. In
|
|
|
|
* case of error, an error message is copied into pop_error.
|
1994-09-27 19:49:25 +00:00
|
|
|
*
|
1998-03-26 22:52:21 +00:00
|
|
|
* Notes: The line returned is overwritten with each call to pop_getline.
|
1994-09-27 19:49:25 +00:00
|
|
|
*
|
|
|
|
* Side effects: Closes the connection on error.
|
1997-12-04 06:44:56 +00:00
|
|
|
*
|
|
|
|
* THE RETURNED LINE MAY CONTAIN EMBEDDED NULLS!
|
1994-09-27 19:49:25 +00:00
|
|
|
*/
|
1997-12-04 06:44:56 +00:00
|
|
|
static int
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_getline (popserver server, char **line)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
#define GETLINE_ERROR "Error reading from server: "
|
|
|
|
|
|
|
|
int ret;
|
1994-10-24 04:41:21 +00:00
|
|
|
int search_offset = 0;
|
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
if (server->data)
|
|
|
|
{
|
1997-12-04 06:44:56 +00:00
|
|
|
char *cp = find_crlf (server->buffer + server->buffer_index,
|
|
|
|
server->data);
|
1994-09-27 19:49:25 +00:00
|
|
|
if (cp)
|
|
|
|
{
|
|
|
|
int found;
|
|
|
|
int data_used;
|
|
|
|
|
|
|
|
found = server->buffer_index;
|
|
|
|
data_used = (cp + 2) - server->buffer - found;
|
2001-12-30 22:09:01 +00:00
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
*cp = '\0'; /* terminate the string to be returned */
|
|
|
|
server->data -= data_used;
|
|
|
|
server->buffer_index += data_used;
|
|
|
|
|
|
|
|
if (pop_debug)
|
1997-12-04 06:44:56 +00:00
|
|
|
/* Embedded nulls will truncate this output prematurely,
|
|
|
|
but that's OK because it's just for debugging anyway. */
|
1994-09-27 19:49:25 +00:00
|
|
|
fprintf (stderr, "<<< %s\n", server->buffer + found);
|
1997-12-04 06:44:56 +00:00
|
|
|
*line = server->buffer + found;
|
|
|
|
return (data_used - 2);
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
Replace bcopy, bzero, bcmp by memcpy, memmove, memset, memcmp
* alloc.c (overrun_check_malloc, overrun_check_realloc)
(overrun_check_free, xstrdup, allocate_string)
(allocate_string_data, compact_small_strings, Fmake_string)
(make_unibyte_string, make_multibyte_string)
(make_string_from_bytes, make_specified_string, make_float)
(Fcons, allocate_terminal, allocate_frame, make_pure_string)
(Fgarbage_collect): Replace bcopy, safe_bcopy, bzero, bcmp by
memcpy, memmove, memset, memcmp.
* atimer.c (start_atimer, set_alarm): Likewise.
* buffer.c (clone_per_buffer_values, report_overlay_modification)
(mmap_realloc, init_buffer_once): Likewise.
* callint.c (Fcall_interactively): Likewise.
* callproc.c (Fcall_process, Fcall_process_region, child_setup)
(getenv_internal_1): Likewise.
* casefiddle.c (casify_object): Likewise.
* ccl.c (ccl_driver): Likewise.
* character.c (str_as_multibyte, str_to_multibyte): Likewise.
* charset.c (load_charset_map_from_file)
(load_charset_map_from_file, load_charset_map_from_vector)
(Fdefine_charset_internal): Likewise.
* cm.c (Wcm_clear): Likewise.
* coding.c (decode_eol, decode_coding_object)
(Fset_coding_system_priority, make_subsidiaries): Likewise.
* data.c (Faset): Likewise.
* dired.c (directory_files_internal, file_name_completion_stat):
Likewise.
* dispnew.c (new_glyph_matrix, adjust_glyph_matrix)
(clear_glyph_row, copy_row_except_pointers)
(copy_glyph_row_contents, new_glyph_pool, realloc_glyph_pool)
(save_current_matrix, restore_current_matrix)
(build_frame_matrix_from_leaf_window, mirrored_line_dance)
(mirror_line_dance, scrolling_window): Likewise.
* doc.c (Fsnarf_documentation, Fsubstitute_command_keys):
Likewise.
* doprnt.c (doprnt): Likewise.
* editfns.c (Fuser_full_name, make_buffer_string_both)
(Fmessage_box, Fformat, Ftranspose_regions): Likewise.
* emacs.c (sort_args): Likewise.
* eval.c (Fapply, Ffuncall): Likewise.
* fileio.c (Ffile_name_directory, make_temp_name)
(Fexpand_file_name, search_embedded_absfilename)
(Fsubstitute_in_file_name, Ffile_symlink_p, Finsert_file_contents)
(auto_save_error): Likewise.
* fns.c (Fstring_equal, Fcopy_sequence, concat)
(string_to_multibyte, Fstring_as_unibyte, Fstring_as_multibyte)
(internal_equal, Fclear_string, larger_vector, copy_hash_table)
(Fmake_hash_table): Likewise.
* fringe.c (Fdefine_fringe_bitmap): Likewise.
* ftfont.c (ftfont_text_extents): Likewise.
* getloadavg.c (getloadavg): Likewise.
* image.c (define_image_type, make_image, make_image_cache)
(x_create_x_image_and_pixmap, xbm_image_p)
(w32_create_pixmap_from_bitmap_data, xbm_load, xpm_lookup_color)
(xpm_image_p, x_create_bitmap_from_xpm_data, xpm_load)
(init_color_table, x_build_heuristic_mask, pbm_image_p, pbm_load)
(png_image_p, png_read_from_memory, png_load, jpeg_image_p)
(tiff_image_p, tiff_read_from_memory, gif_image_p)
(gif_read_from_memory, gif_load, svg_image_p, gs_image_p):
Likewise.
* indent.c (scan_for_column, compute_motion): Likewise.
* insdel.c (gap_left, gap_right, make_gap_smaller, copy_text)
(insert_1_both, insert_from_gap, replace_range_2): Likewise.
* intervals.c (reproduce_tree, reproduce_tree_obj): Likewise.
* keyboard.c (echo_char, save_getcjmp, restore_getcjmp)
(kbd_buffer_store_event_hold, apply_modifiers_uncached)
(store_user_signal_events, menu_bar_items, tool_bar_items)
(process_tool_bar_item, append_tool_bar_item)
(read_char_minibuf_menu_prompt, read_key_sequence)
(Fread_key_sequence, Fread_key_sequence_vector, Frecent_keys):
Likewise.
* keymap.c (current_minor_maps, Fdescribe_buffer_bindings):
Likewise.
* lisp.h (STRING_COPYIN): Likewise.
* lread.c (Fload, read1, oblookup): Likewise.
* msdos.c (Frecent_doskeys): Likewise.
* nsfns.m (Fx_create_frame): Likewise.
* nsfont.m (nsfont_open, nsfont_text_extents, ns_glyph_metrics):
Likewise.
* nsimage.m (EmacsImage-initFromSkipXBM:width:height:)
(EmacsImage-initForXPMWithDepth:width:height:flip:length:):
Likewise.
* nsmenu.m (ns_update_menubar): Likewise.
* nsterm.m (ns_draw_fringe_bitmap, ns_term_init): Likewise.
* print.c (print_unwind, printchar, strout, print_string)
(print_error_message): Likewise.
* process.c (conv_lisp_to_sockaddr, set_socket_option)
(Fmake_network_process, Fnetwork_interface_list)
(Fnetwork_interface_info, read_process_output, Fprocess_send_eof)
(init_process): Likewise.
* ralloc.c (resize_bloc, r_alloc_sbrk, r_alloc_init): Likewise.
* regex.c (init_syntax_once, regex_compile, re_compile_fastmap):
Likewise.
* scroll.c (do_scrolling, do_direct_scrolling)
(scrolling_max_lines_saved): Likewise.
* search.c (search_buffer, wordify, Freplace_match): Likewise.
* sound.c (wav_init, au_init, Fplay_sound_internal): Likewise.
* syntax.c (skip_chars, skip_syntaxes): Likewise.
* sysdep.c (child_setup_tty, sys_subshell, emacs_get_tty)
(emacs_set_tty): Likewise.
* term.c (encode_terminal_code, calculate_costs)
(produce_special_glyphs, create_tty_output, init_tty, delete_tty):
Likewise.
* termcap.c (tgetst1, gobble_line): Likewise.
* termhooks.h (EVENT_INIT): Likewise.
* tparam.c (tparam1): Likewise.
* unexalpha.c (unexec): Likewise.
* unexec.c (write_segment): Likewise.
* unexmacosx.c (unexec_write_zero): Likewise.
* w32fns.c (w32_wnd_proc, Fx_create_frame, x_create_tip_frame)
(Fx_file_dialog, Fsystem_move_file_to_trash): Likewise.
* w32font.c (w32font_list_family, w32font_text_extents)
(w32font_list_internal, w32font_match_internal)
(w32font_open_internal, compute_metrics, Fx_select_font):
Likewise.
* w32menu.c (set_frame_menubar, add_menu_item)
(w32_menu_display_help, w32_free_submenu_strings): Likewise.
* w32term.c (XCreateGC, w32_initialize_display_info): Likewise.
* w32uniscribe.c (uniscribe_list_family): Likewise.
* w32xfns.c (get_next_msg, post_msg, prepend_msg): Likewise.
* window.c (make_window, replace_window, set_window_buffer)
(Fsplit_window): Likewise.
* xdisp.c (init_iterator, RECORD_OVERLAY_STRING, reseat_to_string)
(add_to_log, message3, x_consider_frame_title)
(append_space_for_newline, extend_face_to_end_of_line)
(decode_mode_spec_coding, init_glyph_string): Likewise.
* xfaces.c (x_create_gc, get_lface_attributes_no_remap)
(Finternal_copy_lisp_face, Finternal_merge_in_global_face)
(face_attr_equal_p, make_realized_face, make_face_cache)
(free_realized_faces, lookup_named_face, smaller_face)
(face_with_height, lookup_derived_face)
(x_supports_face_attributes_p, Finternal_set_font_selection_order)
(Finternal_set_font_selection_order, realize_default_face)
(compute_char_face, face_at_buffer_position)
(face_for_overlay_string, face_at_string_position, merge_faces):
Likewise.
* xfns.c (xic_create_fontsetname, Fx_create_frame)
(Fx_window_property, x_create_tip_frame)
(Fx_backspace_delete_keys_p): Likewise.
* xfont.c (xfont_list, xfont_match, xfont_list_family)
(xfont_text_extents): Likewise.
* xmenu.c (set_frame_menubar, xmenu_show): Likewise.
* xrdb.c (magic_file_p, x_get_resource): Likewise.
* xselect.c (x_queue_event, x_get_window_property)
(receive_incremental_selection): Likewise.
* xsmfns.c (x_session_check_input): Likewise.
* xterm.c (x_send_scroll_bar_event, SET_SAVED_MENU_EVENT)
(handle_one_xevent, x_check_errors, xim_initialize, x_term_init):
Likewise.
* character.h (BCOPY_SHORT): Removed.
* config.in: Regenerate.
* dispnew.c (safe_bcopy): Only define as dummy if PROFILING.
* emacs.c (main) [PROFILING]: Don't declare
dump_opcode_frequencies.
* lisp.h (safe_bcopy): Remove declaration.
(memset) [!HAVE_MEMSET]: Declare.
(memcpy) [!HAVE_MEMCPY]: Likewise.
(memmove) [!HAVE_MEMMOVE]: Likewise.
(memcmp) [!HAVE_MEMCMP]: Likewise.
* s/ms-w32.h (bzero, bcopy, bcmp, GAP_USE_BCOPY)
(BCOPY_UPWARD_SAFE, BCOPY_DOWNWARD_SAFE, HAVE_BCOPY, HAVE_BCMP):
Don't define.
(HAVE_MEMCMP, HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET): Define.
* s/msdos.h (GAP_USE_BCOPY, BCOPY_UPWARD_SAFE)
(BCOPY_DOWNWARD_SAFE): Don't define.
* sysdep.c (memset) [!HAVE_MEMSET]: Define.
(memcpy) [!HAVE_MEMCPY]: Define.
(memmove) [!HAVE_MEMMOVE]: Define.
(memcmp) [!HAVE_MEMCMP]: Define.
* config.nt (HAVE_BCOPY, HAVE_BCMP): Remove undefs.
(HAVE_MEMCPY, HAVE_MEMMOVE, HAVE_MEMSET, HAVE_MEMCMP): Add undefs.
* sed2v2.inp (HAVE_MEMCPY, HAVE_MEMSET): Edit to 1.
(HAVE_BZERO): Don't edit.
* lwlib.c (lwlib_memset, lwlib_bcopy): Remove.
(malloc_widget_value, free_widget_info, allocate_widget_instance)
(lw_separator_p): Replace lwlib_memset, lwlib_bcopy, bzero, bcmp by
memset, memcpy, memcmp.
* lwlib-utils.c (XtApplyToWidgets): Likewise.
* xlwmenu.c (XlwMenuInitialize): Likewise.
* lwlib.h (lwlib_bcopy): Remove declaration.
* ebrowse.c (add_sym, make_namespace): Replace bcopy, bzero by
memcpy, memmove, memset.
* pop.c (pop_retrieve, socket_connection, pop_getline): Likewise.
* CPP-DEFINES (BCOPY_DOWNWARD_SAFE, BCOPY_UPWARD_SAFE)
(GAP_USE_BCOPY, HAVE_BCMP, HAVE_BCOPY, bcmp, bcopy, bzero):
Remove.
* configure.in: Don't check for bcopy, bcmp, bzero. Don't include
<strings.h> and don't define bcopy, bzero, BCMP in config.h.
2010-07-07 22:18:28 +00:00
|
|
|
memmove (server->buffer, server->buffer + server->buffer_index,
|
|
|
|
server->data);
|
1994-10-24 04:41:21 +00:00
|
|
|
/* Record the fact that we've searched the data already in
|
|
|
|
the buffer for a CRLF, so that when we search below, we
|
|
|
|
don't have to search the same data twice. There's a "-
|
|
|
|
1" here to account for the fact that the last character
|
|
|
|
of the data we have may be the CR of a CRLF pair, of
|
|
|
|
which we haven't read the second half yet, so we may have
|
|
|
|
to search it again when we read more data. */
|
|
|
|
search_offset = server->data - 1;
|
1994-09-27 19:49:25 +00:00
|
|
|
server->buffer_index = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
server->buffer_index = 0;
|
|
|
|
}
|
|
|
|
|
2019-08-31 17:35:08 +00:00
|
|
|
while (true)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
1998-05-25 20:11:54 +00:00
|
|
|
/* There's a "- 1" here to leave room for the null that we put
|
|
|
|
at the end of the read data below. We put the null there so
|
|
|
|
that find_crlf knows where to stop when we call it. */
|
|
|
|
if (server->data == server->buffer_size - 1)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
1998-05-25 20:11:54 +00:00
|
|
|
server->buffer_size += GETLINE_INCR;
|
|
|
|
server->buffer = (char *)realloc (server->buffer, server->buffer_size);
|
|
|
|
if (! server->buffer)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
1998-05-25 20:11:54 +00:00
|
|
|
strcpy (pop_error, "Out of memory in pop_getline");
|
|
|
|
pop_trash (server);
|
2019-08-31 17:35:08 +00:00
|
|
|
break;
|
1998-04-06 22:16:30 +00:00
|
|
|
}
|
|
|
|
}
|
1998-05-25 20:11:54 +00:00
|
|
|
ret = RECV (server->file, server->buffer + server->data,
|
|
|
|
server->buffer_size - server->data - 1, 0);
|
1994-09-27 19:49:25 +00:00
|
|
|
if (ret < 0)
|
|
|
|
{
|
2012-07-10 21:48:34 +00:00
|
|
|
snprintf (pop_error, ERROR_MAX, "%s%s",
|
|
|
|
GETLINE_ERROR, strerror (errno));
|
1994-09-27 19:49:25 +00:00
|
|
|
pop_trash (server);
|
2019-08-31 17:35:08 +00:00
|
|
|
break;
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
else if (ret == 0)
|
|
|
|
{
|
1998-03-26 22:52:21 +00:00
|
|
|
strcpy (pop_error, "Unexpected EOF from server in pop_getline");
|
1994-09-27 19:49:25 +00:00
|
|
|
pop_trash (server);
|
2019-08-31 17:35:08 +00:00
|
|
|
break;
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
1994-10-18 07:34:59 +00:00
|
|
|
char *cp;
|
1994-09-27 19:49:25 +00:00
|
|
|
server->data += ret;
|
1994-10-18 07:34:59 +00:00
|
|
|
server->buffer[server->data] = '\0';
|
2001-12-30 22:09:01 +00:00
|
|
|
|
1997-12-04 06:44:56 +00:00
|
|
|
cp = find_crlf (server->buffer + search_offset,
|
|
|
|
server->data - search_offset);
|
1994-09-27 19:49:25 +00:00
|
|
|
if (cp)
|
|
|
|
{
|
|
|
|
int data_used = (cp + 2) - server->buffer;
|
|
|
|
*cp = '\0';
|
|
|
|
server->data -= data_used;
|
|
|
|
server->buffer_index = data_used;
|
|
|
|
|
|
|
|
if (pop_debug)
|
|
|
|
fprintf (stderr, "<<< %s\n", server->buffer);
|
1997-12-04 06:44:56 +00:00
|
|
|
*line = server->buffer;
|
|
|
|
return (data_used - 2);
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
1997-05-06 19:30:49 +00:00
|
|
|
/* As above, the "- 1" here is to account for the fact that
|
|
|
|
we may have read a CR without its accompanying LF. */
|
|
|
|
search_offset += ret - 1;
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-08-31 17:35:08 +00:00
|
|
|
return -1;
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: sendline
|
|
|
|
*
|
|
|
|
* Purpose: Sends a line of text to the POP server. The line of text
|
|
|
|
* passed into this function should NOT have the carriage return
|
|
|
|
* and linefeed on the end of it. Periods at beginnings of lines
|
|
|
|
* will NOT be treated specially by this function.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* server The server to which to send the text.
|
|
|
|
* line The line of text to send.
|
|
|
|
*
|
|
|
|
* Return value: Upon successful completion, a value of 0 will be
|
|
|
|
* returned. Otherwise, a non-zero value will be returned, and
|
|
|
|
* an error will be copied into pop_error.
|
|
|
|
*
|
|
|
|
* Side effects: Closes the connection on error.
|
|
|
|
*/
|
|
|
|
static int
|
Fix warnings produced by compiling with -Wwrite_strings (i.e. use const char *).
* b2m.c (concat, fatal): Use const char*.
(main): Don't assign labels a string literal.
* ebrowse.c (struct member): filename, def_filename is const.
(struct sym): filename, sfilename is const.
(struct kw): name is const.
(add_sym, yyerror, token_string, insert_keyword, main): Use const char*.
* emacsclient.c (message, sock_err_message, send_to_emacs)
(quote_argument, set_local_socket)
(start_daemon_and_retry_set_socket): Use const char*.
* etags.c (compressor, language, Ada_suffix, Ada_help, Asm_suffixes)
(Asm_help, default_C_suffixes, default_C_help, Cplusplus_suffixes)
(Cplusplus_help, Cjava_suffixes, Cobol_suffixes, Cstar_suffixes)
(Erlang_suffixes, Erlang_help, Forth_suffixes, Forth_help)
(Fortran_suffixes, Fortran_help, HTML_suffixes, HTML_help)
(Lisp_suffixes, Lisp_help, Lua_suffixes, Lua_help)
(Makefile_filenames, Makefile_help, Objc_suffixes, Objc_help)
(Pascal_suffixes, Pascal_help, Perl_suffixes, Perl_interpreters)
(Perl_help, PHP_suffixes, PHP_help, plain_C_suffixses, PS_suffixes)
(PS_help, Prolog_suffixes, Prolog_help, Python_suffixes, Python_help)
(Scheme_suffixes, Scheme_help, TeX_suffixes, TeX_help, Texinfo_suffixes)
(Texinfo_help, Yacc_suffixes, Yacc_help, auto_help, none_help)
(no_lang_help, print_language_names)
(get_language_from_interpreter, get_language_from_filename)
(init, make_tag, struct C_stab_entry, write_classname, TEX_defenv)
(TEX_decode_env, nocase_tail, savestr, savenstr, fatal, pfatal)
(concat): Use const char*.
* make-docfile.c (error, fatal, scan_c_file, scan_lisp_file): Use
const char *.
* movemail.c (fatal, error, concat): Use const char *.
* pop.c (pop_multi_first, socket_connection, sendline): Use conat char*.
* pop.h (pop_multi_first): Use const char *.
(_ARGS): Remove.
* sorted-doc.c (error, fatal, states): Use const char *.
* update-game-score.c (get_prefix, write_scores, main): Use const char*.
2010-08-11 08:20:34 +00:00
|
|
|
sendline (popserver server, const char *line)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
#define SENDLINE_ERROR "Error writing to POP server: "
|
|
|
|
int ret;
|
2005-07-13 21:47:54 +00:00
|
|
|
char *buf;
|
|
|
|
|
|
|
|
/* Combine the string and the CR-LF into one buffer. Otherwise, two
|
|
|
|
reasonable network stack optimizations, Nagle's algorithm and
|
|
|
|
delayed acks, combine to delay us a fraction of a second on every
|
|
|
|
message we send. (Movemail writes line without \r\n, client
|
|
|
|
kernel sends packet, server kernel delays the ack to see if it
|
|
|
|
can combine it with data, movemail writes \r\n, client kernel
|
|
|
|
waits because it has unacked data already in its outgoing queue,
|
|
|
|
client kernel eventually times out and sends.)
|
|
|
|
|
|
|
|
This can be something like 0.2s per command, which can add up
|
|
|
|
over a few dozen messages, and is a big chunk of the time we
|
|
|
|
spend fetching mail from a server close by. */
|
|
|
|
buf = alloca (strlen (line) + 3);
|
Prefer stpcpy to strcat
* admin/merge-gnulib (GNULIB_MODULES): Add stpcpy.
* lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
* lib/stpcpy.c, m4/stpcpy.m4: New files, from gnulib.
* lib-src/ebrowse.c (sym_scope_1, operator_name, open_file):
* lib-src/emacsclient.c (get_server_config, set_local_socket)
(start_daemon_and_retry_set_socket):
* lib-src/etags.c (main, C_entries, relative_filename):
* lib-src/pop.c (sendline):
* lib-src/update-game-score.c (main):
* lwlib/xlwmenu.c (resource_widget_value):
* src/callproc.c (child_setup):
* src/dbusbind.c (xd_signature_cat):
* src/doc.c (get_doc_string, Fsnarf_documentation):
* src/editfns.c (Fuser_full_name):
* src/frame.c (xrdb_get_resource):
* src/gtkutil.c (xg_get_file_with_chooser):
* src/tparam.c (tparam1):
* src/xfns.c (xic_create_fontsetname):
* src/xrdb.c (gethomedir, get_user_db, get_environ_db):
* src/xsmfns.c (smc_save_yourself_CB):
Rewrite to avoid the need for strcat, typically by using stpcpy
and/or lispstpcpy. strcat tends to be part of O(N**2) algorithms.
* src/doc.c (sibling_etc):
* src/xrdb.c (xdefaults):
Now a top-level static constant.
2014-12-25 12:19:17 +00:00
|
|
|
strcpy (stpcpy (buf, line), "\r\n");
|
2005-07-13 21:47:54 +00:00
|
|
|
ret = fullwrite (server->file, buf, strlen (buf));
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
if (ret < 0)
|
|
|
|
{
|
|
|
|
pop_trash (server);
|
2012-07-10 21:48:34 +00:00
|
|
|
snprintf (pop_error, ERROR_MAX, "%s%s", SENDLINE_ERROR, strerror (errno));
|
1994-09-27 19:49:25 +00:00
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pop_debug)
|
|
|
|
fprintf (stderr, ">>> %s\n", line);
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Procedure: fullwrite
|
|
|
|
*
|
|
|
|
* Purpose: Just like write, but keeps trying until the entire string
|
|
|
|
* has been written.
|
|
|
|
*
|
|
|
|
* Return value: Same as write. Pop_error is not set.
|
|
|
|
*/
|
|
|
|
static int
|
2010-07-03 00:50:23 +00:00
|
|
|
fullwrite (int fd, char *buf, int nbytes)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
char *cp;
|
1997-10-31 23:09:43 +00:00
|
|
|
int ret = 0;
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
cp = buf;
|
1997-10-31 23:09:43 +00:00
|
|
|
while (nbytes && ((ret = SEND (fd, cp, nbytes, 0)) > 0))
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
cp += ret;
|
|
|
|
nbytes -= ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (ret);
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Procedure getok
|
|
|
|
*
|
|
|
|
* Purpose: Reads a line from the server. If the return indicator is
|
|
|
|
* positive, return with a zero exit status. If not, return with
|
|
|
|
* a negative exit status.
|
|
|
|
*
|
|
|
|
* Arguments:
|
|
|
|
* server The server to read from.
|
2001-12-30 22:09:01 +00:00
|
|
|
*
|
1994-09-27 19:49:25 +00:00
|
|
|
* Returns: 0 for success, else for failure and puts error in pop_error.
|
|
|
|
*
|
1996-01-05 10:03:17 +00:00
|
|
|
* Side effects: On failure, may make the connection unusable.
|
1994-09-27 19:49:25 +00:00
|
|
|
*/
|
|
|
|
static int
|
2010-07-03 00:50:23 +00:00
|
|
|
getok (popserver server)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
char *fromline;
|
|
|
|
|
1998-03-26 22:52:21 +00:00
|
|
|
if (pop_getline (server, &fromline) < 0)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (! strncmp (fromline, "+OK", 3))
|
|
|
|
return (0);
|
|
|
|
else if (! strncmp (fromline, "-ERR", 4))
|
|
|
|
{
|
2012-07-10 21:48:34 +00:00
|
|
|
snprintf (pop_error, ERROR_MAX, "%s", fromline);
|
1994-09-27 19:49:25 +00:00
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
strcpy (pop_error,
|
|
|
|
"Unexpected response from server; expecting +OK or -ERR");
|
|
|
|
pop_trash (server);
|
|
|
|
return (-1);
|
|
|
|
}
|
2001-12-30 22:09:01 +00:00
|
|
|
}
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
/*
|
|
|
|
* Function: gettermination
|
|
|
|
*
|
|
|
|
* Purpose: Gets the next line and verifies that it is a termination
|
|
|
|
* line (nothing but a dot).
|
|
|
|
*
|
|
|
|
* Return value: 0 on success, non-zero with pop_error set on error.
|
|
|
|
*
|
|
|
|
* Side effects: Closes the connection on error.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
gettermination (server)
|
|
|
|
popserver server;
|
|
|
|
{
|
|
|
|
char *fromserver;
|
|
|
|
|
1998-03-26 22:52:21 +00:00
|
|
|
if (pop_getline (server, &fromserver) < 0)
|
1994-09-27 19:49:25 +00:00
|
|
|
return (-1);
|
|
|
|
|
|
|
|
if (strcmp (fromserver, "."))
|
|
|
|
{
|
|
|
|
strcpy (pop_error,
|
|
|
|
"Unexpected response from server in gettermination");
|
|
|
|
pop_trash (server);
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (0);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function pop_close
|
|
|
|
*
|
|
|
|
* Purpose: Close a pop connection, sending a "RSET" command to try to
|
|
|
|
* preserve any changes that were made and a "QUIT" command to
|
|
|
|
* try to get the server to quit, but ignoring any responses that
|
|
|
|
* are received.
|
|
|
|
*
|
1996-01-05 10:03:17 +00:00
|
|
|
* Side effects: The server is unusable after this function returns.
|
1994-09-27 19:49:25 +00:00
|
|
|
* Changes made to the maildrop since the session was started (or
|
|
|
|
* since the last pop_reset) may be lost.
|
|
|
|
*/
|
2001-12-30 22:09:01 +00:00
|
|
|
void
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_close (popserver server)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
pop_trash (server);
|
|
|
|
free ((char *) server);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Function: pop_trash
|
|
|
|
*
|
|
|
|
* Purpose: Like pop_close or pop_quit, but doesn't deallocate the
|
2008-02-05 02:30:41 +00:00
|
|
|
* memory associated with the server. It is valid to call
|
1994-09-27 19:49:25 +00:00
|
|
|
* pop_close or pop_quit after this function has been called.
|
|
|
|
*/
|
|
|
|
static void
|
2010-07-03 00:50:23 +00:00
|
|
|
pop_trash (popserver server)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
|
|
|
if (server->file >= 0)
|
|
|
|
{
|
1996-04-28 19:08:33 +00:00
|
|
|
/* avoid recursion; sendline can call pop_trash */
|
|
|
|
if (server->trash_started)
|
|
|
|
return;
|
Use bool for boolean, focusing on headers.
* configure.ac (PTY_OPEN, GC_MARK_SECONDARY_STACK):
Use bool for boolean.
* lib-src/emacsclient.c, lib-src/etags.c, lib-src/hexl.c (FALSE, TRUE):
Remove. All uses replaced with uncapitalized version.
* lib-src/emacsclient.c (message):
* lib-src/etags.c (make_tag, pfnote, consider_token, make_C_tag, lang_names):
* lib-src/hexl.c (un_flag, iso_flag, endian):
* lib-src/pop.c (pop_debug, pop_open, pop_multi_first, pop_multi_next)
(pop_trash):
Use bool for boolean.
* lib-src/etags.c (bool): Remove.
* lib-src/etags.c (globals, members, declarations, no_line_directive)
(no_duplicates): Use 'int' for boolean values that getopt requires
to be 'int'. Formerly, these were 'bool' and 'bool' was 'int',
but we can no longer rely on this implementation.
* lib-src/pop.h (struct _popserver): Use bool_bf for boolean bit-fields.
* lwlib/xlwmenuP.h (XlwMenu_part): Use bool_bf for boolean bit-fields.
* src/atimer.h, src/lisp.h, src/syssignal.h, src/syswait.h, src/unexelf.c:
No need to include <stdbool.h>, since conf_post.h does it now.
* src/buffer.h (BUF_COMPUTE_UNCHANGED, DECODE_POSITION)
(BUFFER_CHECK_INDIRECTION, GET_OVERLAYS_AT, PER_BUFFER_VALUE_P)
(SET_PER_BUFFER_VALUE_P):
* src/ccl.c, src/ccl.h (setup_ccl_program):
* src/ccl.h (CHECK_CCL_PROGRAM):
* src/character.h (MAKE_CHAR_UNIBYTE, CHECK_CHARACTER_CAR)
(CHECK_CHARACTER_CDR, CHAR_STRING_ADVANCE, NEXT_CHAR_BOUNDARY)
(PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE)
(FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE)
(FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE)
(FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH)
(DEC_BOTH, BUF_INC_POS, BUF_DEC_POS):
* src/charset.h (CHECK_CHARSET, CHECK_CHARSET_GET_ID)
(CHECK_CHARSET_GET_ATTR, CHECK_CHARSET_GET_CHARSET)
(CHARSET_FAST_MAP_SET):
* src/coding.c (decode_coding_ccl, encode_coding_ccl):
* src/coding.h (CHECK_CODING_SYSTEM, CHECK_CODING_SYSTEM_GET_SPEC)
(CHECK_CODING_SYSTEM_GET_ID, SJIS_TO_JIS, SJIS_TO_JIS2)
(JIS_TO_SJIS, JIS_TO_SJIS2, ENCODE_FILE, DECODE_FILE)
(ENCODE_SYSTEM, DECODE_SYSTEM, ENCODE_UTF_8)
(decode_coding_c_string):
* src/composite.h (COMPOSITION_DECODE_REFS, COMPOSITION_DECODE_RULE):
* src/conf_post.h (has_attribute):
* src/dispextern.h (trace_redisplay_p):
(INC_TEXT_POS, DEC_TEXT_POS, SET_GLYPH_FROM_GLYPH_CODE)
(SET_CHAR_GLYPH, SET_CHAR_GLYPH_FROM_GLYPH)
(SET_GLYPH_FROM_CHAR_GLYPH):
(WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P)
(FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_SUITABLE_FOR_CHAR_P)
(PRODUCE_GLYPHS, reset_mouse_highlight, in_display_vector_p)
(cursor_in_mouse_face_p):
* src/dispnew.c (adjust_glyph_matrix, clear_glyph_matrix_rows)
(blank_row, prepare_desired_row)
(build_frame_matrix_from_leaf_window, make_current)
(mirror_make_current, mirrored_line_dance, mirror_line_dance)
(update_window, scrolling_window, update_frame_line):
* src/disptab.h (GLYPH_FOLLOW_ALIASES):
* src/editfns.c (Fformat):
* src/font.h (FONT_WEIGHT_SYMBOLIC, FONT_SLANT_SYMBOLIC)
(FONT_WIDTH_SYMBOLIC, FONT_WEIGHT_FOR_FACE, FONT_SLANT_FOR_FACE)
(FONT_WIDTH_FOR_FACE, FONT_WEIGHT_NAME_NUMERIC)
(FONT_SLANT_NAME_NUMERIC, FONT_WIDTH_NAME_NUMERIC)
(FONT_SET_STYLE, CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY)
(CHECK_FONT_OBJECT, CHECK_FONT_GET_OBJECT, FONT_ADD_LOG)
(FONT_DEFERRED_LOG):
* src/frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_WINDOW_P):
(FRAME_EXTERNAL_TOOL_BAR, FRAME_EXTERNAL_MENU_BAR, FOR_EACH_FRAME)
(FRAME_MOUSE_UPDATE):
* src/fringe.c (Fdefine_fringe_bitmap):
* src/image.c (x_create_bitmap_from_data, x_create_bitmap_mask)
(x_create_bitmap_from_xpm_data, xpm_load_image):
* src/intervals.h (INTERVAL_HAS_PARENT, INTERVAL_PARENT)
(set_interval_parent, RESET_INTERVAL, COPY_INTERVAL_CACHE)
(MERGE_INTERVAL_CACHE):
* src/keymap.h (KEYMAPP):
* src/lisp.h (eassert, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE)
(STRING_SET_UNIBYTE, STRING_SET_MULTIBYTE, DEFSYM, PSEUDOVECTORP)
(CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER)
(CHECK_NUMBER_COERCE_MARKER, CHECK_NUMBER_OR_FLOAT_COERCE_MARKER)
(DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT)
(DEFVAR_BUFFER_DEFAULTS, DEFVAR_KBOARD, QUIT)
(RETURN_UNGCPRO, USE_SAFE_ALLOCA, SAFE_NALLOCA, SAFE_FREE)
(SAFE_ALLOCA_LISP, FOR_EACH_ALIST_VALUE, functionp):
* src/syntax.h (SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX)
(UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD)
(SETUP_BUFFER_SYNTAX_TABLE):
* src/systime.h (timespec_valid_p):
* src/term.c (save_and_enable_current_matrix):
* src/window.h (WINDOW_MENU_BAR_P, WINDOW_TOOL_BAR_P):
* src/xdisp.c (in_display_vector_p, display_tool_bar_line)
(redisplay_internal, try_window_reusing_current_matrix)
(sync_frame_with_window_matrix_rows, try_window_id)
(display_menu_bar, display_tty_menu_item, display_mode_line)
(coords_in_mouse_face_p, cursor_in_mouse_face_p):
* src/xmenu.c (xmenu_show):
* src/xterm.c (use_xim, x_term_init):
* src/xterm.h (XSync, GTK_CHECK_VERSION, use_xim, SET_SCROLL_BAR_X_WIDGET)
(struct x_bitmap_record):
Use bool for booleans.
* src/ccl.c (struct buffer_text):
* src/ccl.h (struct ccl_program):
* src/charset.h (struct charset):
* src/cm.h (struct cm):
* src/coding.h (struct iso_2022_spec, struct coding_system):
* src/dispextern.h (struct glyph, struct glyph_matrix, struct glyph_row)
(struct glyph_string, struct face, struct face_cache)
(struct bidi_string_data, struct bidi_it)
(struct draw_fringe_bitmap_params, struct it, Mouse_HLInfo)
(struct image):
* src/editfns.c (Fformat):
* src/frame.h (struct frame):
* src/fringe.c (struct fringe_bitmap):
* src/intervals.h (struct interval):
* src/keyboard.h (struct kboard):
* src/lisp.h (struct Lisp_Symbol, struct Lisp_Misc_Any, struct Lisp_Marker)
(struct Lisp_Overlay, struct Lisp_Save_Value, struct Lisp_Free)
(struct Lisp_Buffer_Local_Value, union specbinding):
* src/macfont.m (struct macfont_info):
* src/process.h (struct Lisp_Process):
* src/termchar.h (struct tty_display_info):
* src/window.h (struct window):
* src/xterm.h (struct x_output):
Use bool_bf for boolean bit-fields.
* src/ccl.c (setup_ccl_program): Now returns bool instead of -1 or 0.
All callers changed.
* src/ccl.h (struct ccl_program): Remove unused members private_state,
src_multibyte, dst_multibyte, cr_consumed, suppress_error,
eight_bit_control.
(struct ccl_spec): Remove unused members cr_carryover,
eight_bit_carryover.
* src/conf_post.h: Include <stdbool.h>.
(bool_bf): New type.
* src/dispextern.h (TRACE, PREPARE_FACE_FOR_DISPLAY):
* src/interval.h (RESET_INTERVAL, COPY_INTERVAL_CACHE, MERGE_INTERVAL_CACHE)
Surround statement macro with proper 'do { ... } while (false)' brackets.
(SET_MATRIX_ROW_ENABLED_P): Assume 2nd arg is bool.
(PRODUCE_GLYPHS): Simplify use of boolean.
* src/fileio.c (Fcopy_file):
If I is an integer, prefer 'if (I != 0)' to 'if (I)'.
* src/lisp.h (UNGCPRO): Return void, not int.
(FOR_EACH_TAIL): Use void expression, not int expression.
* src/region-cache.c: Reindent.
* src/region-cache.h: Copy comments from region-cache.c, to fix
incorrect remarks about booleans.
2013-12-14 21:36:44 +00:00
|
|
|
server->trash_started = true;
|
1996-04-29 15:46:17 +00:00
|
|
|
|
1994-09-27 19:49:25 +00:00
|
|
|
sendline (server, "RSET");
|
|
|
|
sendline (server, "QUIT");
|
|
|
|
|
1996-04-29 15:46:17 +00:00
|
|
|
CLOSESOCKET (server->file);
|
1994-09-27 19:49:25 +00:00
|
|
|
server->file = -1;
|
|
|
|
if (server->buffer)
|
|
|
|
{
|
|
|
|
free (server->buffer);
|
|
|
|
server->buffer = 0;
|
|
|
|
}
|
|
|
|
}
|
1996-04-28 19:08:33 +00:00
|
|
|
|
|
|
|
#ifdef WINDOWSNT
|
|
|
|
if (have_winsock)
|
|
|
|
WSACleanup ();
|
|
|
|
#endif
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
|
1997-12-04 06:44:56 +00:00
|
|
|
/* Return a pointer to the first CRLF in IN_STRING, which can contain
|
|
|
|
embedded nulls and has LEN characters in it not including the final
|
|
|
|
null, or 0 if it does not contain one. */
|
1994-09-27 19:49:25 +00:00
|
|
|
|
|
|
|
static char *
|
2010-07-03 00:50:23 +00:00
|
|
|
find_crlf (char *in_string, int len)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
1997-12-04 06:44:56 +00:00
|
|
|
while (len--)
|
1994-09-27 19:49:25 +00:00
|
|
|
{
|
1997-12-04 06:44:56 +00:00
|
|
|
if (*in_string == '\r')
|
1994-10-19 22:52:57 +00:00
|
|
|
{
|
|
|
|
if (*++in_string == '\n')
|
|
|
|
return (in_string - 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
in_string++;
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
1997-12-04 06:44:56 +00:00
|
|
|
return (0);
|
1994-09-27 19:49:25 +00:00
|
|
|
}
|
|
|
|
|
2016-03-05 10:12:58 +00:00
|
|
|
#ifdef WINDOWSNT
|
|
|
|
/* The following 2 functions are only available since XP, so we load
|
|
|
|
them dynamically and provide fallbacks. */
|
|
|
|
|
|
|
|
int (WINAPI *pfn_getaddrinfo) (const char *, const char *,
|
|
|
|
const struct addrinfo *, struct addrinfo **);
|
|
|
|
void (WINAPI *pfn_freeaddrinfo) (struct addrinfo *);
|
|
|
|
|
|
|
|
static int
|
|
|
|
load_ws2 (void)
|
|
|
|
{
|
|
|
|
static int ws2_loaded = 0;
|
|
|
|
|
|
|
|
if (!ws2_loaded)
|
|
|
|
{
|
|
|
|
HANDLE ws2_lib = LoadLibrary ("Ws2_32.dll");
|
|
|
|
|
|
|
|
if (ws2_lib != NULL)
|
|
|
|
{
|
|
|
|
ws2_loaded = 1;
|
|
|
|
pfn_getaddrinfo = (void *) GetProcAddress (ws2_lib, "getaddrinfo");
|
|
|
|
pfn_freeaddrinfo = (void *) GetProcAddress (ws2_lib, "freeaddrinfo");
|
|
|
|
/* Paranoia: these two functions should go together, so if
|
|
|
|
one is absent, we cannot use the other. */
|
|
|
|
if (pfn_getaddrinfo == NULL)
|
|
|
|
pfn_freeaddrinfo = NULL;
|
|
|
|
else if (pfn_freeaddrinfo == NULL)
|
|
|
|
pfn_getaddrinfo = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!ws2_loaded)
|
|
|
|
{
|
|
|
|
errno = ENETDOWN;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
sys_getaddrinfo (const char *node, const char *service,
|
|
|
|
const struct addrinfo *hints, struct addrinfo **res)
|
|
|
|
{
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
if (load_ws2 () != 0)
|
|
|
|
{
|
|
|
|
errno = ENETDOWN;
|
|
|
|
return WSANO_RECOVERY;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pfn_getaddrinfo)
|
|
|
|
rc = pfn_getaddrinfo (node, service, hints, res);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
int port = 0;
|
|
|
|
struct hostent *host_info;
|
|
|
|
struct gai_storage {
|
|
|
|
struct addrinfo addrinfo;
|
|
|
|
struct sockaddr_in sockaddr_in;
|
|
|
|
} *gai_storage;
|
|
|
|
|
|
|
|
/* We don't support any flags besides AI_CANONNAME. */
|
|
|
|
if (hints && (hints->ai_flags & ~(AI_CANONNAME)) != 0)
|
|
|
|
return WSAEINVAL;
|
|
|
|
/* NODE cannot be NULL, since pop.c has fallbacks for that. */
|
|
|
|
if (!node)
|
|
|
|
return WSAHOST_NOT_FOUND;
|
|
|
|
|
|
|
|
if (service)
|
|
|
|
{
|
|
|
|
const char *protocol =
|
|
|
|
(hints && hints->ai_socktype == SOCK_DGRAM) ? "udp" : "tcp";
|
|
|
|
struct servent *srv = getservbyname (service, protocol);
|
|
|
|
|
|
|
|
if (srv)
|
|
|
|
port = srv->s_port;
|
|
|
|
else
|
|
|
|
return WSAHOST_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
gai_storage = calloc (1, sizeof *gai_storage);
|
|
|
|
gai_storage->sockaddr_in.sin_port = port;
|
|
|
|
host_info = gethostbyname (node);
|
|
|
|
if (host_info)
|
|
|
|
{
|
|
|
|
memcpy (&gai_storage->sockaddr_in.sin_addr,
|
|
|
|
host_info->h_addr, host_info->h_length);
|
|
|
|
gai_storage->sockaddr_in.sin_family = host_info->h_addrtype;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
free (gai_storage);
|
|
|
|
return WSAHOST_NOT_FOUND;
|
|
|
|
}
|
|
|
|
|
|
|
|
gai_storage->addrinfo.ai_addr =
|
|
|
|
(struct sockaddr *)&gai_storage->sockaddr_in;
|
|
|
|
gai_storage->addrinfo.ai_addrlen = sizeof (gai_storage->sockaddr_in);
|
|
|
|
if (hints && (hints->ai_flags & AI_CANONNAME) != 0)
|
|
|
|
{
|
|
|
|
gai_storage->addrinfo.ai_canonname = strdup (host_info->h_name);
|
|
|
|
if (!gai_storage->addrinfo.ai_canonname)
|
|
|
|
{
|
|
|
|
free (gai_storage);
|
|
|
|
return WSA_NOT_ENOUGH_MEMORY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gai_storage->addrinfo.ai_protocol = (hints) ? hints->ai_protocol : 0;
|
|
|
|
gai_storage->addrinfo.ai_socktype = (hints) ? hints->ai_socktype : 0;
|
|
|
|
gai_storage->addrinfo.ai_family = gai_storage->sockaddr_in.sin_family;
|
|
|
|
gai_storage->addrinfo.ai_next = NULL;
|
|
|
|
|
|
|
|
*res = &gai_storage->addrinfo;
|
|
|
|
rc = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
sys_freeaddrinfo (struct addrinfo *ai)
|
|
|
|
{
|
|
|
|
if (load_ws2 () != 0)
|
|
|
|
{
|
|
|
|
errno = ENETDOWN;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pfn_freeaddrinfo)
|
|
|
|
pfn_freeaddrinfo (ai);
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (ai->ai_canonname)
|
|
|
|
free (ai->ai_canonname);
|
|
|
|
free (ai);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* WINDOWSNT */
|
1994-09-27 19:49:25 +00:00
|
|
|
#endif /* MAIL_USE_POP */
|