aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorMiles Bader2007-12-06 09:51:45 +0000
committerMiles Bader2007-12-06 09:51:45 +0000
commit0bd508417142ff377f34aec8dcec9438d9175c2c (patch)
tree4d60fe09e5cebf7d79766b11e9cda8cc1c9dbb9b /lib-src
parent98fe991da804a42f53f6a5e84cd5eab18a82e181 (diff)
parent9fb1ba8090da3528de56158a79bd3527d31c7f2f (diff)
downloademacs-0bd508417142ff377f34aec8dcec9438d9175c2c.tar.gz
emacs-0bd508417142ff377f34aec8dcec9438d9175c2c.zip
Merge from emacs--devo--0
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-294
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog37
-rw-r--r--lib-src/etags.c91
-rw-r--r--lib-src/makefile.w32-in4
-rw-r--r--lib-src/pop.c66
4 files changed, 148 insertions, 50 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 2c178ba8da9..2cc37d49dd4 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,40 @@
12007-11-28 Jason Rumney <jasonr@gnu.org>
2
3 * makefile.w32-in (VMS_SUPPORT): No longer byte-compiled.
4
52007-11-27 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
6
7 * pop.c (socket_connection): Remove AI_ADDRCONFIG.
8
92007-11-19 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
10
11 * pop.c (socket_connection): Move realhost out of #ifdefs.
12 Set realhost both for HAVE_GETADDRINFO and !HAVE_GETADDRINFO.
13
142007-11-18 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
15
16 * pop.c (socket_connection): Use getaddrinfo if available.
17
182007-11-22 Francesco Potort,Al(B <pot@gnu.org>
19
20 * etags.c (default_C_help) [CTAGS]: differentiate the help string,
21 as the defaults in ctags are different from etags.
22
232007-11-15 Francesco Potort,Al(B <pot@gnu.org>
24
25 * etags.c: Make prototypes for extern definitions, and add all
26 that are needed to quench warnings on 64-bit.
27 (main): Use the same defaults for ctags as for etags: find
28 typedefs, structure tags, macro constants, enum constants, struct
29 members and global variables.
30 (make_C_tag) [DEBUG]: Add debugging printout.
31 (C_entries): In case '}' decrement bracelev before testing it.
32
332007-11-15 Masatake YAMATO <jet@gyve.org>
34
35 * etags.c (C_entries): In case '}', set fvdef to fvnone
36 unconditioned to (!ignoreindent && lp == newlb.buffer + 1).
37
12007-11-01 Dan Nicolaescu <dann@ics.uci.edu> 382007-11-01 Dan Nicolaescu <dann@ics.uci.edu>
2 39
3 * makefile.w32-in (obj): Remove sunfns.o. 40 * makefile.w32-in (obj): Remove sunfns.o.
diff --git a/lib-src/etags.c b/lib-src/etags.c
index 0412137496f..23527171e48 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -81,7 +81,7 @@ University of California, as described above. */
81 * configuration file containing regexp definitions for etags. 81 * configuration file containing regexp definitions for etags.
82 */ 82 */
83 83
84char pot_etags_version[] = "@(#) pot revision number is 17.34"; 84char pot_etags_version[] = "@(#) pot revision number is 17.38";
85 85
86#define TRUE 1 86#define TRUE 1
87#define FALSE 0 87#define FALSE 0
@@ -160,14 +160,20 @@ char pot_etags_version[] = "@(#) pot revision number is 17.34";
160# include <stdlib.h> 160# include <stdlib.h>
161# include <string.h> 161# include <string.h>
162# else /* no standard C headers */ 162# else /* no standard C headers */
163 extern char *getenv (); 163 extern char *getenv __P((const char *));
164 extern char *strcpy (); 164 extern char *strcpy __P((char *, const char *));
165 extern char *strncpy (); 165 extern char *strncpy __P((char *, const char *, unsigned long));
166 extern char *strcat (); 166 extern char *strcat __P((char *, const char *));
167 extern char *strncat (); 167 extern char *strncat __P((char *, const char *, unsigned long));
168 extern unsigned long strlen (); 168 extern int strcmp __P((const char *, const char *));
169 extern PTR malloc (); 169 extern int strncmp __P((const char *, const char *, unsigned long));
170 extern PTR realloc (); 170 extern int system __P((const char *));
171 extern unsigned long strlen __P((const char *));
172 extern void *malloc __P((unsigned long));
173 extern void *realloc __P((void *, unsigned long));
174 extern void exit __P((int));
175 extern void free __P((void *));
176 extern void *memmove __P((void *, const void *, unsigned long));
171# ifdef VMS 177# ifdef VMS
172# define EXIT_SUCCESS 1 178# define EXIT_SUCCESS 1
173# define EXIT_FAILURE 0 179# define EXIT_FAILURE 0
@@ -491,7 +497,7 @@ static char
491 *midtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789"; 497 *midtk = "ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz$0123456789";
492 498
493static bool append_to_tagfile; /* -a: append to tags */ 499static bool append_to_tagfile; /* -a: append to tags */
494/* The next five default to TRUE for etags, but to FALSE for ctags. */ 500/* The next five default to TRUE in C and derived languages. */
495static bool typedefs; /* -t: create tags for C and Ada typedefs */ 501static bool typedefs; /* -t: create tags for C and Ada typedefs */
496static bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */ 502static bool typedefs_or_cplusplus; /* -T: create tags for C typedefs, level */
497 /* 0 struct/enum/union decls, and C++ */ 503 /* 0 struct/enum/union decls, and C++ */
@@ -508,7 +514,7 @@ static bool update; /* -u: update tags */
508static bool vgrind_style; /* -v: create vgrind style index output */ 514static bool vgrind_style; /* -v: create vgrind style index output */
509static bool no_warnings; /* -w: suppress warnings (undocumented) */ 515static bool no_warnings; /* -w: suppress warnings (undocumented) */
510static bool cxref_style; /* -x: create cxref style output */ 516static bool cxref_style; /* -x: create cxref style output */
511static bool cplusplus; /* .[hc] means C++, not C */ 517static bool cplusplus; /* .[hc] means C++, not C (undocumented) */
512static bool ignoreindent; /* -I: ignore indentation in C */ 518static bool ignoreindent; /* -I: ignore indentation in C */
513static bool packages_only; /* --packages-only: in Ada, only tag packages*/ 519static bool packages_only; /* --packages-only: in Ada, only tag packages*/
514 520
@@ -615,10 +621,19 @@ followed by a colon, are tags.";
615 621
616 622
617/* Note that .c and .h can be considered C++, if the --c++ flag was 623/* Note that .c and .h can be considered C++, if the --c++ flag was
618 given, or if the `class' or `template' keyowrds are met inside the file. 624 given, or if the `class' or `template' keywords are met inside the file.
619 That is why default_C_entries is called for these. */ 625 That is why default_C_entries is called for these. */
620static char *default_C_suffixes [] = 626static char *default_C_suffixes [] =
621 { "c", "h", NULL }; 627 { "c", "h", NULL };
628#if CTAGS /* C help for Ctags */
629static char default_C_help [] =
630"In C code, any C function is a tag. Use -t to tag typedefs.\n\
631Use -T to tag definitions of `struct', `union' and `enum'.\n\
632Use -d to tag `#define' macro definitions and `enum' constants.\n\
633Use --globals to tag global variables.\n\
634You can tag function declarations and external variables by\n\
635using `--declarations', and struct members by using `--members'.";
636#else /* C help for Etags */
622static char default_C_help [] = 637static char default_C_help [] =
623"In C code, any C function or typedef is a tag, and so are\n\ 638"In C code, any C function or typedef is a tag, and so are\n\
624definitions of `struct', `union' and `enum'. `#define' macro\n\ 639definitions of `struct', `union' and `enum'. `#define' macro\n\
@@ -629,6 +644,7 @@ definitions and `enum' constants are tags unless you specify\n\
629`--no-members' can make the tags table file much smaller.\n\ 644`--no-members' can make the tags table file much smaller.\n\
630You can tag function declarations and external variables by\n\ 645You can tag function declarations and external variables by\n\
631using `--declarations'."; 646using `--declarations'.";
647#endif /* C help for Ctags and Etags */
632 648
633static char *Cplusplus_suffixes [] = 649static char *Cplusplus_suffixes [] =
634 { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx", 650 { "C", "c++", "cc", "cpp", "cxx", "H", "h++", "hh", "hpp", "hxx",
@@ -883,7 +899,7 @@ etags --help --lang=ada.");
883# define EMACS_NAME "standalone" 899# define EMACS_NAME "standalone"
884#endif 900#endif
885#ifndef VERSION 901#ifndef VERSION
886# define VERSION "17.34" 902# define VERSION "17.38"
887#endif 903#endif
888static void 904static void
889print_version () 905print_version ()
@@ -1239,15 +1255,12 @@ main (argc, argv)
1239 argbuffer = xnew (argc, argument); 1255 argbuffer = xnew (argc, argument);
1240 1256
1241 /* 1257 /*
1242 * If etags, always find typedefs and structure tags. Why not? 1258 * Always find typedefs and structure tags.
1243 * Also default to find macro constants, enum constants, struct 1259 * Also default to find macro constants, enum constants, struct
1244 * members and global variables. 1260 * members and global variables. Do it for both etags and ctags.
1245 */ 1261 */
1246 if (!CTAGS) 1262 typedefs = typedefs_or_cplusplus = constantypedefs = TRUE;
1247 { 1263 globals = members = TRUE;
1248 typedefs = typedefs_or_cplusplus = constantypedefs = TRUE;
1249 globals = members = TRUE;
1250 }
1251 1264
1252 /* When the optstring begins with a '-' getopt_long does not rearrange the 1265 /* When the optstring begins with a '-' getopt_long does not rearrange the
1253 non-options arguments to be at the end, but leaves them alone. */ 1266 non-options arguments to be at the end, but leaves them alone. */
@@ -1498,6 +1511,7 @@ main (argc, argv)
1498 exit (EXIT_SUCCESS); 1511 exit (EXIT_SUCCESS);
1499 } 1512 }
1500 1513
1514 /* From here on, we are in (CTAGS && !cxref_style) */
1501 if (update) 1515 if (update)
1502 { 1516 {
1503 char cmd[BUFSIZ]; 1517 char cmd[BUFSIZ];
@@ -3006,11 +3020,6 @@ consider_token (str, len, c, c_extp, bracelev, parlev, is_func_or_var)
3006 return TRUE; 3020 return TRUE;
3007 } 3021 }
3008 3022
3009 /*
3010 * This structdef business is NOT invoked when we are ctags and the
3011 * file is plain C. This is because a struct tag may have the same
3012 * name as another tag, and this loses with ctags.
3013 */
3014 switch (toktype) 3023 switch (toktype)
3015 { 3024 {
3016 case st_C_javastruct: 3025 case st_C_javastruct:
@@ -3246,16 +3255,16 @@ make_C_tag (isfun)
3246{ 3255{
3247 /* This function is never called when token.valid is FALSE, but 3256 /* This function is never called when token.valid is FALSE, but
3248 we must protect against invalid input or internal errors. */ 3257 we must protect against invalid input or internal errors. */
3249 if (!DEBUG && !token.valid)
3250 return;
3251
3252 if (token.valid) 3258 if (token.valid)
3253 make_tag (token_name.buffer, token_name.len, isfun, token.line, 3259 make_tag (token_name.buffer, token_name.len, isfun, token.line,
3254 token.offset+token.length+1, token.lineno, token.linepos); 3260 token.offset+token.length+1, token.lineno, token.linepos);
3255 else /* this case is optimised away if !DEBUG */ 3261 else if (DEBUG)
3256 make_tag (concat ("INVALID TOKEN:-->", token_name.buffer, ""), 3262 { /* this branch is optimised away if !DEBUG */
3257 token_name.len + 17, isfun, token.line, 3263 make_tag (concat ("INVALID TOKEN:-->", token_name.buffer, ""),
3258 token.offset+token.length+1, token.lineno, token.linepos); 3264 token_name.len + 17, isfun, token.line,
3265 token.offset+token.length+1, token.lineno, token.linepos);
3266 error ("INVALID TOKEN", NULL);
3267 }
3259 3268
3260 token.valid = FALSE; 3269 token.valid = FALSE;
3261} 3270}
@@ -3978,7 +3987,7 @@ C_entries (c_ext, inf)
3978 make_C_tag (FALSE); /* a struct or enum */ 3987 make_C_tag (FALSE); /* a struct or enum */
3979 break; 3988 break;
3980 } 3989 }
3981 bracelev++; 3990 bracelev += 1;
3982 break; 3991 break;
3983 case '*': 3992 case '*':
3984 if (definedef != dnone) 3993 if (definedef != dnone)
@@ -3992,23 +4001,21 @@ C_entries (c_ext, inf)
3992 case '}': 4001 case '}':
3993 if (definedef != dnone) 4002 if (definedef != dnone)
3994 break; 4003 break;
4004 bracelev -= 1;
3995 if (!ignoreindent && lp == newlb.buffer + 1) 4005 if (!ignoreindent && lp == newlb.buffer + 1)
3996 { 4006 {
3997 if (bracelev != 0) 4007 if (bracelev != 0)
3998 token.valid = FALSE; 4008 token.valid = FALSE; /* unexpected value, token unreliable */
3999 bracelev = 0; /* reset brace level if first column */ 4009 bracelev = 0; /* reset brace level if first column */
4000 parlev = 0; /* also reset paren level, just in case... */ 4010 parlev = 0; /* also reset paren level, just in case... */
4001 } 4011 }
4002 else 4012 else if (bracelev < 0)
4003 { 4013 {
4004 if (--bracelev < 0) 4014 token.valid = FALSE; /* something gone amiss, token unreliable */
4005 { 4015 bracelev = 0;
4006 bracelev = 0;
4007 token.valid = FALSE; /* something gone amiss, token unreliable */
4008 }
4009 if (bracelev == 0 && fvdef == vignore)
4010 fvdef = fvnone; /* end of function */
4011 } 4016 }
4017 if (bracelev == 0 && fvdef == vignore)
4018 fvdef = fvnone; /* end of function */
4012 popclass_above (bracelev); 4019 popclass_above (bracelev);
4013 structdef = snone; 4020 structdef = snone;
4014 /* Only if typdef == tinbody is typdefbracelev significant. */ 4021 /* Only if typdef == tinbody is typdefbracelev significant. */
diff --git a/lib-src/makefile.w32-in b/lib-src/makefile.w32-in
index 8e01c9dfeaf..8b327bfabf8 100644
--- a/lib-src/makefile.w32-in
+++ b/lib-src/makefile.w32-in
@@ -187,8 +187,8 @@ MSDOS_SUPPORT = \
187 $(lispsource)international/ccl.elc \ 187 $(lispsource)international/ccl.elc \
188 $(lispsource)international/codepage.elc 188 $(lispsource)international/codepage.elc
189VMS_SUPPORT = \ 189VMS_SUPPORT = \
190 $(lispsource)vmsproc.elc \ 190 $(lispsource)vmsproc.el \
191 $(lispsource)vms-patch.elc 191 $(lispsource)vms-patch.el
192TOOLTIP_SUPPORT = $(lispsource)tooltip.elc 192TOOLTIP_SUPPORT = $(lispsource)tooltip.elc
193WINDOW_SUPPORT = \ 193WINDOW_SUPPORT = \
194 $(lispsource)fringe.elc \ 194 $(lispsource)fringe.elc \
diff --git a/lib-src/pop.c b/lib-src/pop.c
index 9fcbe4b370c..5e6623aaf8d 100644
--- a/lib-src/pop.c
+++ b/lib-src/pop.c
@@ -1010,12 +1010,19 @@ socket_connection (host, flags)
1010 char *host; 1010 char *host;
1011 int flags; 1011 int flags;
1012{ 1012{
1013#ifdef HAVE_GETADDRINFO
1014 struct addrinfo *res, *it;
1015 struct addrinfo hints;
1016 int ret;
1017#else /* !HAVE_GETADDRINFO */
1013 struct hostent *hostent; 1018 struct hostent *hostent;
1019#endif
1014 struct servent *servent; 1020 struct servent *servent;
1015 struct sockaddr_in addr; 1021 struct sockaddr_in addr;
1016 char found_port = 0; 1022 char found_port = 0;
1017 char *service; 1023 char *service;
1018 int sock; 1024 int sock;
1025 char *realhost;
1019#ifdef KERBEROS 1026#ifdef KERBEROS
1020#ifdef KERBEROS5 1027#ifdef KERBEROS5
1021 krb5_error_code rem; 1028 krb5_error_code rem;
@@ -1031,11 +1038,11 @@ socket_connection (host, flags)
1031 CREDENTIALS cred; 1038 CREDENTIALS cred;
1032 Key_schedule schedule; 1039 Key_schedule schedule;
1033 int rem; 1040 int rem;
1034 char *realhost;
1035#endif /* KERBEROS5 */ 1041#endif /* KERBEROS5 */
1036#endif /* KERBEROS */ 1042#endif /* KERBEROS */
1037 1043
1038 int try_count = 0; 1044 int try_count = 0;
1045 int connect_ok;
1039 1046
1040#ifdef WINDOWSNT 1047#ifdef WINDOWSNT
1041 { 1048 {
@@ -1097,6 +1104,46 @@ socket_connection (host, flags)
1097 1104
1098 } 1105 }
1099 1106
1107#ifdef HAVE_GETADDRINFO
1108 memset (&hints, 0, sizeof(hints));
1109 hints.ai_socktype = SOCK_STREAM;
1110 hints.ai_flags = AI_CANONNAME;
1111 hints.ai_family = AF_INET;
1112 do
1113 {
1114 ret = getaddrinfo (host, service, &hints, &res);
1115 try_count++;
1116 if (ret != 0 && (ret != EAI_AGAIN || try_count == 5))
1117 {
1118 strcpy (pop_error, "Could not determine POP server's address");
1119 return (-1);
1120 }
1121 } while (ret != 0);
1122
1123 if (ret == 0)
1124 {
1125 it = res;
1126 while (it)
1127 {
1128 if (it->ai_addrlen == sizeof (addr))
1129 {
1130 struct sockaddr_in *in_a = (struct sockaddr_in *) it->ai_addr;
1131 bcopy (&in_a->sin_addr, (char *) &addr.sin_addr,
1132 sizeof (addr.sin_addr));
1133 if (! connect (sock, (struct sockaddr *) &addr, sizeof (addr)))
1134 break;
1135 }
1136 it = it->ai_next;
1137 }
1138 connect_ok = it != NULL;
1139 if (connect_ok)
1140 {
1141 realhost = alloca (strlen (it->ai_canonname) + 1);
1142 strcpy (realhost, it->ai_canonname);
1143 }
1144 freeaddrinfo (res);
1145 }
1146#else /* !HAVE_GETADDRINFO */
1100 do 1147 do
1101 { 1148 {
1102 hostent = gethostbyname (host); 1149 hostent = gethostbyname (host);
@@ -1116,10 +1163,18 @@ socket_connection (host, flags)
1116 break; 1163 break;
1117 hostent->h_addr_list++; 1164 hostent->h_addr_list++;
1118 } 1165 }
1166 connect_ok = *hostent->h_addr_list != NULL;
1167 if (! connect_ok)
1168 {
1169 realhost = alloca (strlen (hostent->h_name) + 1);
1170 strcpy (realhost, hostent->h_name);
1171 }
1172
1173#endif /* !HAVE_GETADDRINFO */
1119 1174
1120#define CONNECT_ERROR "Could not connect to POP server: " 1175#define CONNECT_ERROR "Could not connect to POP server: "
1121 1176
1122 if (! *hostent->h_addr_list) 1177 if (! connect_ok)
1123 { 1178 {
1124 CLOSESOCKET (sock); 1179 CLOSESOCKET (sock);
1125 strcpy (pop_error, CONNECT_ERROR); 1180 strcpy (pop_error, CONNECT_ERROR);
@@ -1130,6 +1185,7 @@ socket_connection (host, flags)
1130 } 1185 }
1131 1186
1132#ifdef KERBEROS 1187#ifdef KERBEROS
1188
1133#define KRB_ERROR "Kerberos error connecting to POP server: " 1189#define KRB_ERROR "Kerberos error connecting to POP server: "
1134 if (! (flags & POP_NO_KERBEROS)) 1190 if (! (flags & POP_NO_KERBEROS))
1135 { 1191 {
@@ -1157,7 +1213,7 @@ socket_connection (host, flags)
1157 if (rem = krb5_cc_get_principal (kcontext, ccdef, &client)) 1213 if (rem = krb5_cc_get_principal (kcontext, ccdef, &client))
1158 goto krb5error; 1214 goto krb5error;
1159 1215
1160 for (cp = hostent->h_name; *cp; cp++) 1216 for (cp = realhost; *cp; cp++)
1161 { 1217 {
1162 if (isupper (*cp)) 1218 if (isupper (*cp))
1163 { 1219 {
@@ -1165,7 +1221,7 @@ socket_connection (host, flags)
1165 } 1221 }
1166 } 1222 }
1167 1223
1168 if (rem = krb5_sname_to_principal (kcontext, hostent->h_name, 1224 if (rem = krb5_sname_to_principal (kcontext, realhost,
1169 POP_SERVICE, FALSE, &server)) 1225 POP_SERVICE, FALSE, &server))
1170 goto krb5error; 1226 goto krb5error;
1171 1227
@@ -1210,7 +1266,6 @@ socket_connection (host, flags)
1210 } 1266 }
1211#else /* ! KERBEROS5 */ 1267#else /* ! KERBEROS5 */
1212 ticket = (KTEXT) malloc (sizeof (KTEXT_ST)); 1268 ticket = (KTEXT) malloc (sizeof (KTEXT_ST));
1213 realhost = strdup (hostent->h_name);
1214 rem = krb_sendauth (0L, sock, ticket, "pop", realhost, 1269 rem = krb_sendauth (0L, sock, ticket, "pop", realhost,
1215 (char *) krb_realmofhost (realhost), 1270 (char *) krb_realmofhost (realhost),
1216 (unsigned long) 0, &msg_data, &cred, schedule, 1271 (unsigned long) 0, &msg_data, &cred, schedule,
@@ -1218,7 +1273,6 @@ socket_connection (host, flags)
1218 (struct sockaddr_in *) 0, 1273 (struct sockaddr_in *) 0,
1219 "KPOPV0.1"); 1274 "KPOPV0.1");
1220 free ((char *) ticket); 1275 free ((char *) ticket);
1221 free (realhost);
1222 if (rem != KSUCCESS) 1276 if (rem != KSUCCESS)
1223 { 1277 {
1224 strcpy (pop_error, KRB_ERROR); 1278 strcpy (pop_error, KRB_ERROR);