comparison src/dired.c @ 377:d883f39b8495 r21-2b4

Import from CVS: tag r21-2b4
author cvs
date Mon, 13 Aug 2007 11:05:42 +0200
parents 6240c7796c7a
children 8626e4521993
comparison
equal deleted inserted replaced
376:e2295b4d9f2e 377:d883f39b8495
374 Bufbyte *d_name; 374 Bufbyte *d_name;
375 375
376 dp = readdir (d); 376 dp = readdir (d);
377 if (!dp) break; 377 if (!dp) break;
378 378
379 /* #### This is a bad idea, because d_name can contain 379 /* Cast to Bufbyte* is OK, as readdir() Mule-encapsulates. */
380 control characters, which can make XEmacs crash. This
381 should be handled properly with FORMAT_FILENAME. */
382 d_name = (Bufbyte *) dp->d_name; 380 d_name = (Bufbyte *) dp->d_name;
383 len = NAMLEN (dp); 381 len = NAMLEN (dp);
384 cclen = bytecount_to_charcount (d_name, len); 382 cclen = bytecount_to_charcount (d_name, len);
385 383
386 QUIT; 384 QUIT;
529 return Qt; 527 return Qt;
530 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize)); 528 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize));
531 } 529 }
532 530
533 531
532
533 /* The *pwent() functions do not exist on NT */
534 #ifndef WINDOWSNT
535
534 static Lisp_Object user_name_completion (Lisp_Object user, 536 static Lisp_Object user_name_completion (Lisp_Object user,
535 int all_flag, 537 int all_flag,
536 int *uniq); 538 int *uniq);
537 539
538 DEFUN ("user-name-completion", Fuser_name_completion, 1, 1, 0, /* 540 DEFUN ("user-name-completion", Fuser_name_completion, 1, 1, 0, /*
773 return bestmatch; 775 return bestmatch;
774 if (matchcount == 1 && bestmatchsize == user_name_length) 776 if (matchcount == 1 && bestmatchsize == user_name_length)
775 return Qt; 777 return Qt;
776 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize)); 778 return Fsubstring (bestmatch, Qzero, make_int (bestmatchsize));
777 } 779 }
780 #endif /* ! defined WINDOWSNT */
778 781
779 782
780 Lisp_Object 783 Lisp_Object
781 make_directory_hash_table (CONST char *path) 784 make_directory_hash_table (CONST char *path)
782 { 785 {
789 792
790 while ((dp = readdir (d))) 793 while ((dp = readdir (d)))
791 { 794 {
792 Bytecount len = NAMLEN (dp); 795 Bytecount len = NAMLEN (dp);
793 if (DIRENTRY_NONEMPTY (dp)) 796 if (DIRENTRY_NONEMPTY (dp))
794 Fputhash (make_ext_string ((Bufbyte *) dp->d_name, len, 797 /* Cast to Bufbyte* is OK, as readdir() Mule-encapsulates. */
795 FORMAT_FILENAME), Qt, hash); 798 Fputhash (make_string ((Bufbyte *) dp->d_name, len), Qt, hash);
796 } 799 }
797 closedir (d); 800 closedir (d);
798 } 801 }
799 return hash; 802 return hash;
800 } 803 }
936 defsymbol (&Qfile_attributes, "file-attributes"); 939 defsymbol (&Qfile_attributes, "file-attributes");
937 940
938 DEFSUBR (Fdirectory_files); 941 DEFSUBR (Fdirectory_files);
939 DEFSUBR (Ffile_name_completion); 942 DEFSUBR (Ffile_name_completion);
940 DEFSUBR (Ffile_name_all_completions); 943 DEFSUBR (Ffile_name_all_completions);
944 #ifndef WINDOWSNT
941 DEFSUBR (Fuser_name_completion); 945 DEFSUBR (Fuser_name_completion);
942 DEFSUBR (Fuser_name_completion_1); 946 DEFSUBR (Fuser_name_completion_1);
943 DEFSUBR (Fuser_name_all_completions); 947 DEFSUBR (Fuser_name_all_completions);
948 #endif
944 DEFSUBR (Ffile_attributes); 949 DEFSUBR (Ffile_attributes);
945 } 950 }
946 951
947 void 952 void
948 vars_of_dired (void) 953 vars_of_dired (void)