Skip to content

Instantly share code, notes, and snippets.

@hnw
Last active December 25, 2015 00:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hnw/6885340 to your computer and use it in GitHub Desktop.
Save hnw/6885340 to your computer and use it in GitHub Desktop.
diff -r -c coreutils-8.21-orig/lib/mountlist.c coreutils-8.21/lib/mountlist.c
*** coreutils-8.21-orig/lib/mountlist.c 2013-02-08 01:44:47.000000000 +0900
--- coreutils-8.21/lib/mountlist.c 2013-10-08 23:09:10.000000000 +0900
***************
*** 424,429 ****
--- 424,432 ----
#ifdef MOUNTED_GETMNTENT1 /* GNU/Linux, 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
{
+ # ifdef __ANDROID__
+ return NULL;
+ # else
struct mntent *mnt;
char const *table = MOUNTED;
FILE *fp;
***************
*** 450,455 ****
--- 453,459 ----
if (endmntent (fp) == 0)
goto free_then_fail;
+ # endif
}
#endif /* MOUNTED_GETMNTENT1. */
diff -r -c coreutils-8.21-orig/lib/stdio-impl.h coreutils-8.21/lib/stdio-impl.h
*** coreutils-8.21-orig/lib/stdio-impl.h 2013-01-02 21:34:46.000000000 +0900
--- coreutils-8.21/lib/stdio-impl.h 2013-10-08 21:59:22.000000000 +0900
***************
*** 57,63 ****
# define fp_ fp
# endif
! # if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ /* NetBSD >= 1.5ZA, OpenBSD */
/* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
struct __sfileext
--- 57,63 ----
# define fp_ fp
# endif
! # if (defined __NetBSD__ && __NetBSD_Version__ >= 105270000) || defined __OpenBSD__ || defined __ANDROID__ /* NetBSD >= 1.5ZA, OpenBSD */
/* See <http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup>
and <http://www.openbsd.org/cgi-bin/cvsweb/src/lib/libc/stdio/fileext.h?rev=HEAD&content-type=text/x-cvsweb-markup> */
struct __sfileext
diff -r -c coreutils-8.21-orig/src/dd.c coreutils-8.21/src/dd.c
*** coreutils-8.21-orig/src/dd.c 2013-02-07 18:37:05.000000000 +0900
--- coreutils-8.21/src/dd.c 2013-10-08 22:17:47.000000000 +0900
***************
*** 1489,1495 ****
#ifdef __linux__
! # include <sys/mtio.h>
# define MT_SAME_POSITION(P, Q) \
((P).mt_resid == (Q).mt_resid \
--- 1489,1499 ----
#ifdef __linux__
! # ifdef __ANDROID__
! # include <linux/mtio.h>
! # else
! # include <sys/mtio.h>
! # endif
# define MT_SAME_POSITION(P, Q) \
((P).mt_resid == (Q).mt_resid \
diff -r -c coreutils-8.21-orig/src/pinky.c coreutils-8.21/src/pinky.c
*** coreutils-8.21-orig/src/pinky.c 2013-01-31 09:46:24.000000000 +0900
--- coreutils-8.21/src/pinky.c 2013-10-08 23:17:58.000000000 +0900
***************
*** 242,254 ****
--- 242,262 ----
printf (" %19s", _(" ???"));
else
{
+ #ifdef __ANDROID__
+ char *const comma = strchr ("", ',');
+ #else
char *const comma = strchr (pw->pw_gecos, ',');
+ #endif
char *result;
if (comma)
*comma = '\0';
+ #ifdef __ANDROID__
+ result = create_fullname ("", pw->pw_name);
+ #else
result = create_fullname (pw->pw_gecos, pw->pw_name);
+ #endif
printf (" %-19.19s", result);
free (result);
}
***************
*** 323,335 ****
--- 331,351 ----
}
else
{
+ #ifdef __ANDROID__
+ char *const comma = strchr ("", ',');
+ #else
char *const comma = strchr (pw->pw_gecos, ',');
+ #endif
char *result;
if (comma)
*comma = '\0';
+ #ifdef __ANDROID__
+ result = create_fullname ("", pw->pw_name);
+ #else
result = create_fullname (pw->pw_gecos, pw->pw_name);
+ #endif
printf (" %s", result);
free (result);
}
diff -r -c coreutils-8.21-orig/src/stat.c coreutils-8.21/src/stat.c
*** coreutils-8.21-orig/src/stat.c 2013-01-31 09:46:24.000000000 +0900
--- coreutils-8.21/src/stat.c 2013-10-08 22:36:52.000000000 +0900
***************
*** 955,961 ****
--- 955,963 ----
out_uint (pformat, prefix_len, statbuf->st_uid);
break;
case 'U':
+ #ifndef __ANDROID__
setpwent ();
+ #endif
pw_ent = getpwuid (statbuf->st_uid);
out_string (pformat, prefix_len,
pw_ent ? pw_ent->pw_name : "UNKNOWN");
***************
*** 964,970 ****
--- 966,974 ----
out_uint (pformat, prefix_len, statbuf->st_gid);
break;
case 'G':
+ #ifndef __ANDROID__
setgrent ();
+ #endif
gw_ent = getgrgid (statbuf->st_gid);
out_string (pformat, prefix_len,
gw_ent ? gw_ent->gr_name : "UNKNOWN");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment