comparison src/editfns.c @ 14:9ee227acff29 r19-15b90

Import from CVS: tag r19-15b90
author cvs
date Mon, 13 Aug 2007 08:48:42 +0200
parents 376386a54a3c
children 859a2309aef8
comparison
equal deleted inserted replaced
13:13c6d0aaafe5 14:9ee227acff29
130 { 130 {
131 /* Jamie reports that IRIX gets wedged by SIGIO/SIGALARM occurring 131 /* Jamie reports that IRIX gets wedged by SIGIO/SIGALARM occurring
132 in select(), called from getpwnam(). */ 132 in select(), called from getpwnam(). */
133 slow_down_interrupts (); 133 slow_down_interrupts ();
134 pw = (struct passwd *) 134 pw = (struct passwd *)
135 getpwnam ((char *) string_data (XSTRING (Vuser_login_name))); 135 getpwnam ((char *) XSTRING_DATA (Vuser_login_name));
136 speed_up_interrupts (); 136 speed_up_interrupts ();
137 } 137 }
138 138
139 p = (Bufbyte *) ((pw) ? USER_FULL_NAME : "unknown"); /* don't gettext here */ 139 p = (Bufbyte *) ((pw) ? USER_FULL_NAME : "unknown"); /* don't gettext here */
140 q = (Bufbyte *) strchr ((char *) p, ','); 140 q = (Bufbyte *) strchr ((char *) p, ',');
141 Vuser_full_name = make_ext_string (p, (q ? q - p : strlen ((char *) p)), 141 Vuser_full_name = make_ext_string (p, (q ? q - p : strlen ((char *) p)),
142 FORMAT_OS); 142 FORMAT_OS);
143 143
144 #ifdef AMPERSAND_FULL_NAME 144 #ifdef AMPERSAND_FULL_NAME
145 p = string_data (XSTRING (Vuser_full_name)); 145 p = XSTRING_DATA (Vuser_full_name);
146 q = (Bufbyte *) strchr ((char *) p, '&'); 146 q = (Bufbyte *) strchr ((char *) p, '&');
147 /* Substitute the login name for the &, upcasing the first character. */ 147 /* Substitute the login name for the &, upcasing the first character. */
148 if (q) 148 if (q)
149 { 149 {
150 char *r = (char *) 150 char *r = (char *)
151 alloca (strlen ((char *) p) + 151 alloca (strlen ((char *) p) + XSTRING_LENGTH (Vuser_login_name) + 1);
152 string_length (XSTRING (Vuser_login_name)) + 1);
153 Charcount fullname_off = bytecount_to_charcount (p, q - p); 152 Charcount fullname_off = bytecount_to_charcount (p, q - p);
154 memcpy (r, p, q - p); 153 memcpy (r, p, q - p);
155 r[q - p] = 0; 154 r[q - p] = 0;
156 strcat (r, (char *) string_data (XSTRING (Vuser_login_name))); 155 strcat (r, (char *) XSTRING_DATA (Vuser_login_name));
157 strcat (r, q + 1); 156 strcat (r, q + 1);
158 Vuser_full_name = build_string (r); 157 Vuser_full_name = build_string (r);
159 set_string_char (XSTRING (Vuser_full_name), fullname_off, 158 set_string_char (XSTRING (Vuser_full_name), fullname_off,
160 UPCASE (current_buffer, 159 UPCASE (current_buffer,
161 string_char (XSTRING (Vuser_full_name), 160 string_char (XSTRING (Vuser_full_name),
600 */ ) 599 */ )
601 (buffer) 600 (buffer)
602 Lisp_Object buffer; 601 Lisp_Object buffer;
603 { 602 {
604 struct buffer *b = decode_buffer (buffer, 1); 603 struct buffer *b = decode_buffer (buffer, 1);
605 if (BUF_PT (b) == BUF_BEGV (b)) 604 return BUF_PT (b) == BUF_BEGV (b) ? Qt : Qnil;
606 return Qt;
607 return Qnil;
608 } 605 }
609 606
610 DEFUN ("eobp", Feobp, Seobp, 0, 1, 0 /* 607 DEFUN ("eobp", Feobp, Seobp, 0, 1, 0 /*
611 Return T if point is at the end of the buffer. 608 Return T if point is at the end of the buffer.
612 If the buffer is narrowed, this means the end of the narrowed part. 609 If the buffer is narrowed, this means the end of the narrowed part.
614 */ ) 611 */ )
615 (buffer) 612 (buffer)
616 Lisp_Object buffer; 613 Lisp_Object buffer;
617 { 614 {
618 struct buffer *b = decode_buffer (buffer, 1); 615 struct buffer *b = decode_buffer (buffer, 1);
619 if (BUF_PT (b) == BUF_ZV (b)) 616 return BUF_PT (b) == BUF_ZV (b) ? Qt : Qnil;
620 return Qt;
621 return Qnil;
622 } 617 }
623 618
624 int 619 int
625 beginning_of_line_p (struct buffer *b, Bufpos pt) 620 beginning_of_line_p (struct buffer *b, Bufpos pt)
626 { 621 {
792 FORMAT_OS)); 787 FORMAT_OS));
793 788
794 #ifdef AMPERSAND_FULL_NAME 789 #ifdef AMPERSAND_FULL_NAME
795 if (!NILP (tem)) 790 if (!NILP (tem))
796 { 791 {
797 p = (char *) string_data (XSTRING (tem)); 792 p = (char *) XSTRING_DATA (tem);
798 q = strchr (p, '&'); 793 q = strchr (p, '&');
799 /* Substitute the login name for the &, upcasing the first character. */ 794 /* Substitute the login name for the &, upcasing the first character. */
800 if (q) 795 if (q)
801 { 796 {
802 char *r = (char *) alloca (strlen (p) + 797 char *r = (char *) alloca (strlen (p) + XSTRING_LENGTH (uname) + 1);
803 string_length (XSTRING (uname)) + 1);
804 memcpy (r, p, q - p); 798 memcpy (r, p, q - p);
805 r[q - p] = 0; 799 r[q - p] = 0;
806 strcat (r, (char *) string_data (XSTRING (uname))); 800 strcat (r, (char *) XSTRING_DATA (uname));
807 /* #### current_buffer dependency! */ 801 /* #### current_buffer dependency! */
808 r[q - p] = UPCASE (current_buffer, r[q - p]); 802 r[q - p] = UPCASE (current_buffer, r[q - p]);
809 strcat (r, q + 1); 803 strcat (r, q + 1);
810 tem = build_string (r); 804 tem = build_string (r);
811 } 805 }
829 /* For the benefit of callers who don't want to include lisp.h. 823 /* For the benefit of callers who don't want to include lisp.h.
830 Caller must free! */ 824 Caller must free! */
831 char * 825 char *
832 get_system_name (void) 826 get_system_name (void)
833 { 827 {
834 return xstrdup ((char *) string_data (XSTRING (Vsystem_name))); 828 return xstrdup ((char *) XSTRING_DATA (Vsystem_name));
835 } 829 }
836 830
837 DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0 /* 831 DEFUN ("emacs-pid", Femacs_pid, Semacs_pid, 0, 0, 0 /*
838 Return the process ID of Emacs, as an integer. 832 Return the process ID of Emacs, as an integer.
839 */ ) 833 */ )
983 977
984 if (! lisp_to_time (_time, &value)) 978 if (! lisp_to_time (_time, &value))
985 error ("Invalid time specification"); 979 error ("Invalid time specification");
986 980
987 /* This is probably enough. */ 981 /* This is probably enough. */
988 size = string_length (XSTRING (format_string)) * 6 + 50; 982 size = XSTRING_LENGTH (format_string) * 6 + 50;
989 983
990 while (1) 984 while (1)
991 { 985 {
992 char *buf = (char *) alloca (size); 986 char *buf = (char *) alloca (size);
993 *buf = 1; 987 *buf = 1;
994 if (emacs_strftime (buf, size, 988 if (emacs_strftime (buf, size,
995 (CONST char *) string_data (XSTRING (format_string)), 989 (CONST char *) XSTRING_DATA (format_string),
996 localtime (&value)) 990 localtime (&value))
997 || !*buf) 991 || !*buf)
998 return build_ext_string (buf, FORMAT_BINARY); 992 return build_ext_string (buf, FORMAT_BINARY);
999 /* If buffer was too small, make it bigger. */ 993 /* If buffer was too small, make it bigger. */
1000 size *= 2; 994 size *= 2;
1098 char tzbuf[100]; 1092 char tzbuf[100];
1099 char *tzstring; 1093 char *tzstring;
1100 char **oldenv = environ, **newenv; 1094 char **oldenv = environ, **newenv;
1101 1095
1102 if (STRINGP (zone)) 1096 if (STRINGP (zone))
1103 tzstring = (char *) string_data (XSTRING (zone)); 1097 tzstring = (char *) XSTRING_DATA (zone);
1104 else if (INTP (zone)) 1098 else if (INTP (zone))
1105 { 1099 {
1106 int abszone = abs (XINT (zone)); 1100 int abszone = abs (XINT (zone));
1107 sprintf (tzbuf, "XXX%s%d:%02d:%02d", "-" + (XINT (zone) < 0), 1101 sprintf (tzbuf, "XXX%s%d:%02d:%02d", "-" + (XINT (zone) < 0),
1108 abszone / (60*60), (abszone/60) % 60, abszone % 60); 1102 abszone / (60*60), (abszone/60) % 60, abszone % 60);
1291 if (NILP (tz)) 1285 if (NILP (tz))
1292 tzstring = 0; 1286 tzstring = 0;
1293 else 1287 else
1294 { 1288 {
1295 CHECK_STRING (tz); 1289 CHECK_STRING (tz);
1296 tzstring = (char *) string_data (XSTRING (tz)); 1290 tzstring = (char *) XSTRING_DATA (tz);
1297 } 1291 }
1298 1292
1299 set_time_zone_rule (tzstring); 1293 set_time_zone_rule (tzstring);
1300 if (environbuf) 1294 if (environbuf)
1301 xfree (environbuf); 1295 xfree (environbuf);