From 7f0cd3022a91d19b4fdd4af8f56d901e9ade5a3f Mon Sep 17 00:00:00 2001 From: Michal Luscon Date: Tue, 17 Jan 2012 18:23:40 +0100 Subject: [PATCH] eject: clean up includes Signed-off-by: Michal Luscon --- misc-utils/eject.c | 30 +++++++++++------------------- misc-utils/i18n.h | 22 ---------------------- 2 files changed, 11 insertions(+), 41 deletions(-) delete mode 100644 misc-utils/i18n.h diff --git a/misc-utils/eject.c b/misc-utils/eject.c index 172278e020..99f3a3c941 100644 --- a/misc-utils/eject.c +++ b/misc-utils/eject.c @@ -29,17 +29,12 @@ * */ -#include "i18n.h" +//#include "i18n.h" +#include "linux_version.h" +#include "c.h" +#include "nls.h" - -#define DEFAULTDEVICE "/dev/sr0" - - -#include -/* handy macro found in 2.1 kernels, but not in older ones */ -#ifndef KERNEL_VERSION -#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) -#endif +#define EJECT_DEFAULT_DEVICE "/dev/sr0" #include #include @@ -48,9 +43,8 @@ #include #include -#ifdef GETOPTLONG + #include -#endif /* GETOPTLONG */ #include #include #include @@ -58,11 +52,7 @@ #include #include #include -#include #include -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,1,0) -#include -#endif #include #include #include @@ -166,7 +156,7 @@ static void usage() "Parameter can be a device file or a mount point.\n" "If omitted, name defaults to `%s'.\n" "By default tries -r, -s, -f, and -q in order until success.\n"), - DEFAULTDEVICE); + EJECT_DEFAULT_DEVICE); exit(1); } @@ -905,7 +895,7 @@ void HandleXOption(char *deviceName) /* main program */ int main(int argc, char **argv) { - const char *defaultDevice = DEFAULTDEVICE; /* default if no name passed by user */ + const char *defaultDevice = EJECT_DEFAULT_DEVICE; /* default if no name passed by user */ int worked = 0; /* set to 1 when successfully ejected */ char *device = 0; /* name passed from user */ char *fullName; /* expanded name */ @@ -918,7 +908,9 @@ int main(int argc, char **argv) char *pattern; /* regex for device if multiple partitions */ int ld = 6; /* symbolic link max depth */ - I18NCODE + setlocale(LC_ALL,""); + textdomain("eject"); + bindtextdomain("eject",LOCALEDIR); /* program name is global variable used by other procedures */ programName = strdup(argv[0]); diff --git a/misc-utils/i18n.h b/misc-utils/i18n.h deleted file mode 100644 index e4c821b8a6..0000000000 --- a/misc-utils/i18n.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - i18nized by: KUN-CHUNG, HSIEH - Taiwan - - Homepage: http://www.geocities.com/linux4tw/ - - µ{¦¡°ê»Ú¤Æ³]­p: Á±X¤¤ -*/ - -#ifndef __i18n__ - #define __i18n__ - #define PKG "eject" - #define LOCALEDIR "/usr/share/locale" - - #include - #include - #define _(str) gettext (str) - #define N_(str) (str) - #define I18NCODE setlocale(LC_ALL,""); textdomain(PKG); bindtextdomain(PKG,LOCALEDIR); - - void i18n_init (void); -#endif -- 2.47.3