char *optional_system_delim = NULL;
int optional_filename_case = NONE;
-#if defined(__CYGWIN__) || defined(__hpux)
+#if defined(__CYGWIN__) || defined(__MINGW32__) || defined(__hpux)
/* Cygwin, HP-UX and other UNIX are able to use SJIS as native code. */
int default_system_kanji_code = CODE_SJIS;
#else
name[i] = toupper(name[i]);
continue;
}
- if (case_to == TO_LOWER && islower(name[i])) {
- name[i] = toupper(name[i]);
+ if (case_to == TO_LOWER && isupper(name[i])) {
+ name[i] = tolower(name[i]);
continue;
}
}
/* ------------------------------------------------------------------------ */
#if !defined(HAVE_TZSET) && !defined(HAVE_FTIME) /* maybe defined(HAVE_GETTIMEOFDAY) */
{
-#ifdef HAVE_TM_GMTOFF
+#ifdef HAVE_STRUCT_TM_TM_GMTOFF
time_t tt;
time(&tt);
return -localtime(&tt)->tm_gmtoff;
-#else /* HAVE_TM_GMTOFF */
+#else /* HAVE_STRUCT_TM_TM_GMTOFF */
struct timeval tp;
struct timezone tzp;
gettimeofday(&tp, &tzp);/* specific to 4.3BSD */
* 60L : 0));
*/
return (tzp.tz_minuteswest * 60L);
-#endif /* HAVE_TM_GMTOFF */
+#endif /* HAVE_STRUCT_TM_TM_GMTOFF */
}
#endif
#endif /* defined(HAVE_FTIME) || defined(HAVE_GETTIMEOFDAY) ||
for (i = 0; i < header_size - 3; i++)
hdr->name[i] = (char) get_byte();
hdr->name[header_size - 3] = '\0';
- name_length = header_size - 3; /* modified by Koji Arai */
+ name_length = header_size - 3;
break;
case 2:
/*
/*
* UNIX group name
*/
- setup_get(get_ptr + header_size - 3);
+ for (i = 0; i < header_size - 3; i++)
+ hdr->group[i] = get_byte();
+ hdr->group[i] = '\0';
break;
case 0x53:
/*
* UNIX user name
*/
- setup_get(get_ptr + header_size - 3);
+ for (i = 0; i < header_size - 3; i++)
+ hdr->user[i] = get_byte();
+ hdr->user[i] = '\0';
break;
case 0x54:
/*
hdr->unix_uid = v_stat->st_uid;
hdr->unix_gid = v_stat->st_gid;
+#if HAVE_GETPWUID
+ {
+ struct passwd *ent = getpwuid(hdr->unix_uid);
+
+ if (ent) {
+ strncpy(hdr->user, ent->pw_name, sizeof(hdr->user));
+ if (hdr->user[sizeof(hdr->user)-1])
+ hdr->user[sizeof(hdr->user)-1] = 0;
+ }
+ }
+#endif
+#if HAVE_GETGRGID
+ {
+ struct group *ent = getgrgid(hdr->unix_gid);
+
+ if (ent) {
+ strncpy(hdr->group, ent->gr_name, sizeof(hdr->group));
+ if (hdr->group[sizeof(hdr->group)-1])
+ hdr->group[sizeof(hdr->group)-1] = 0;
+ }
+ }
+#endif
if (is_directory(v_stat)) {
bcopy(LZHDIRS_METHOD, hdr->method, METHOD_TYPE_STRAGE);
hdr->attribute = GENERIC_DIRECTORY_ATTRIBUTE;
put_word(hdr->unix_gid);
put_word(hdr->unix_uid);
+ {
+ int i, len = strlen(hdr->group);
+ put_word(len + 3);
+ put_byte(0x52); /* group name */
+ for (i = 0; i < len; i++)
+ put_byte(hdr->group[i]);
+
+ len = strlen(hdr->user);
+ put_word(len + 3);
+ put_byte(0x53); /* user name */
+ for (i = 0; i < len; i++)
+ put_byte(hdr->user[i]);
+ }
+
if (p = (char *) strrchr(hdr->name, DELIM2)) {
int i;
/* tab-width:4 */
/* compile-command:"gcc -c header.c" */
/* End: */
+/* vi: set tabstop=4: */