diff options
author | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-12-29 16:15:36 (GMT) |
---|---|---|
committer | Andy Cedilnik <andy.cedilnik@kitware.com> | 2005-12-29 16:15:36 (GMT) |
commit | c5e532d07dd4e820be2a81b07e12629690425027 (patch) | |
tree | 7d4826cf4541482e9a27e2f87f211c7c56e2fac3 /Utilities | |
parent | 14c256ddba587105d72a8d219f961cd73b38503e (diff) | |
download | CMake-c5e532d07dd4e820be2a81b07e12629690425027.zip CMake-c5e532d07dd4e820be2a81b07e12629690425027.tar.gz CMake-c5e532d07dd4e820be2a81b07e12629690425027.tar.bz2 |
COMP: Try to remove warnings and add support for cygwin
Diffstat (limited to 'Utilities')
-rw-r--r-- | Utilities/cmtar/output.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/Utilities/cmtar/output.c b/Utilities/cmtar/output.c index 95d628b..14757f4 100644 --- a/Utilities/cmtar/output.c +++ b/Utilities/cmtar/output.c @@ -13,10 +13,12 @@ #include <libtarint/internal.h> #include <stdio.h> -#ifndef WIN32 -#include <pwd.h> -#include <grp.h> + +#if !defined(_WIN32) || defined(__CYGWIN__) +# include <pwd.h> +# include <grp.h> #endif + #include <time.h> #include <limits.h> @@ -64,7 +66,7 @@ void th_print_long_ls(TAR *t) { char modestring[12]; -#ifndef WIN32 +#if !defined(_WIN32) || defined(__CYGWIN__) struct passwd *pw; struct group *gr; #endif @@ -85,26 +87,26 @@ th_print_long_ls(TAR *t) #endif uid = th_get_uid(t); -#ifndef WIN32 +#if !defined(_WIN32) || defined(__CYGWIN__) pw = getpwuid(uid); if (pw != NULL) strlcpy(username, pw->pw_name, sizeof(username)); else #endif - snprintf(username, sizeof(username), "%d", uid); + snprintf(username, sizeof(username), "%d", (int)uid); gid = th_get_gid(t); -#ifndef WIN32 +#if !defined(_WIN32) || defined(__CYGWIN__) gr = getgrgid(gid); if (gr != NULL) strlcpy(groupname, gr->gr_name, sizeof(groupname)); else #endif - snprintf(groupname, sizeof(groupname), "%d", gid); + snprintf(groupname, sizeof(groupname), "%d", (int)gid); strmode(th_get_mode(t), modestring); printf("%.10s %-8.8s %-8.8s ", modestring, username, groupname); -#ifndef WIN32 +#if !defined(_WIN32) || defined(__CYGWIN__) if (TH_ISCHR(t) || TH_ISBLK(t)) printf(" %3d, %3d ", th_get_devmajor(t), th_get_devminor(t)); else @@ -124,7 +126,7 @@ th_print_long_ls(TAR *t) printf(" %s", th_get_pathname(t)); -#ifndef _WIN32 +#if !defined(_WIN32) || defined(__CYGWIN__) if (TH_ISSYM(t) || TH_ISLNK(t)) { if (TH_ISSYM(t)) |