Skip to contentSkip to conversation

simpleinit: remove NLS support

PATCH In review Francesco Cosoleto 2 participants 3 messages Jun 2, 2011 – Jun 8, 2011 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 simpleinit: remove NLS support

About 50 messages to translate less.

shutdown(1) is deprecated since July 2007, simpleinit(1), initctl(1) are deprecated since December 2010. They are marked as deprecated why nobody uses these implementations.

---
 simpleinit/shutdown.c   |   64 ++++++++++++++++++++++------------------------
 simpleinit/simpleinit.c |   42 ++++++++++++++----------------
 2 files changed, 51 insertions(+), 55 deletions(-)
simpleinit/shutdown.c +31 -33
index 9bb121c..6c6fe52 100644
@@ -113,7 +113,7 @@ void
 usage(void)
 {
 	fprintf(stderr,
-		_("Usage: shutdown [-h|-r] [-fqs] [now|hh:ss|+mins]\n"));
+		"Usage: shutdown [-h|-r] [-fqs] [now|hh:ss|+mins]\n");
 	exit(EXIT_FAILURE);
 }
 
@@ -131,7 +131,7 @@ int_handler(int sig)
 {
 	unlink(_PATH_NOLOGIN);
 	signal(SIGINT, SIG_DFL);
-	my_puts(_("Shutdown process aborted"));
+	my_puts("Shutdown process aborted");
 	_exit(EXIT_FAILURE);
 }
 
@@ -157,12 +157,10 @@ main(int argc, char *argv[])
 	for (i = 1; i < NSIG; i++) signal (i, SIG_DFL);
 
         setlocale(LC_ALL, "");
-        bindtextdomain(PACKAGE, LOCALEDIR);
-        textdomain(PACKAGE);
 
 #ifndef DEBUGGING
 	if(setreuid (0, 0))
-		errx(EXIT_FAILURE, _("only root can shut a system down."));
+		errx(EXIT_FAILURE, "only root can shut a system down.");
 #endif
 
 	if(*argv[0] == '-') argv[0]++;	/* allow shutdown as login shell */
@@ -252,8 +250,8 @@ main(int argc, char *argv[])
 			then = 3600 * hour + 60 * minute;
 			timeout = then - now;
 			if(timeout < 0)
-				errx(EXIT_FAILURE, _("that must be tomorrow, "
-					          "can't you wait till then?"));
+				errx(EXIT_FAILURE, "that must be tomorrow, "
+					          "can't you wait till then?");
 		} else {
 			xstrncpy(message, argv[c], sizeof(message));
 			opt_msgset = 1;
@@ -301,7 +299,7 @@ main(int argc, char *argv[])
 		}
 		*ptr = '\0';
 	} else if (!opt_msgset) {
-		strcpy(message, _("for maintenance; bounce, bounce"));
+		strcpy(message, "for maintenance; bounce, bounce");
 	}
 
 #ifdef DEBUGGING
@@ -329,11 +327,11 @@ main(int argc, char *argv[])
 	if((fd = open(_PATH_NOLOGIN, O_WRONLY|O_CREAT, 0644)) >= 0) {
 		/* keep xgettext happy and leave \r\n outside strings */
 		WRCRLF;
-		WR(_("The system is being shut down within 5 minutes"));
+		WR("The system is being shut down within 5 minutes");
 		WRCRLF;
 		write(fd, message, strlen(message));
 		WRCRLF;
-		WR(_("Login is therefore prohibited."));
+		WR("Login is therefore prohibited.");
 		WRCRLF;
 		close(fd);
 	}
@@ -355,10 +353,10 @@ main(int argc, char *argv[])
 	/* do syslog message... */
 	openlog(prog, LOG_CONS, LOG_AUTH);
 	if (opt_reboot)
-		syslog(LOG_NOTICE, _("rebooted by %s: %s"), 
+		syslog(LOG_NOTICE, "rebooted by %s: %s",
 		       whom, message);
 	else
-		syslog(LOG_NOTICE, _("halted by %s: %s"), 
+		syslog(LOG_NOTICE, "halted by %s: %s",
 		       whom, message);
 	closelog();
 
@@ -422,9 +420,9 @@ main(int argc, char *argv[])
 
 	if(opt_reboot) {
 		my_reboot(LINUX_REBOOT_CMD_RESTART); /* RB_AUTOBOOT */
-		my_puts(_("\nWhy am I still alive after reboot?"));
+		my_puts("\nWhy am I still alive after reboot?");
 	} else {
-		my_puts(_("\nNow you can turn off the power..."));
+		my_puts("\nNow you can turn off the power...");
 
 		/* allow C-A-D now, [email protected], re-fixed 8-Jul-96 */
 		my_reboot(LINUX_REBOOT_CMD_CAD_ON); /* RB_ENABLE_CAD */
@@ -440,10 +438,10 @@ main(int argc, char *argv[])
 void
 do_halt(char *action) {
 	if (strcasecmp (action, "power_off") == 0) {
-		printf(_("Calling kernel power-off facility...\n"));
+		printf("Calling kernel power-off facility...\n");
 		fflush(stdout);
 		my_reboot(LINUX_REBOOT_CMD_POWER_OFF);
-		printf(_("Error powering off\t%s\n"), ERRSTRING);
+		printf("Error powering off\t%s\n", ERRSTRING);
 		fflush(stdout);
 		sleep (2);
 	} else
@@ -451,10 +449,10 @@ do_halt(char *action) {
 	/* This should be improved; e.g. Mike Jagdis wants "/sbin/mdstop -a" */
 	/* Maybe we should also fork and wait */
 	if (action[0] == '/') {
-		printf(_("Executing the program \"%s\" ...\n"), action);
+		printf("Executing the program \"%s\" ...\n", action);
 		fflush(stdout);
 		execl(action, action, NULL);
-		printf(_("Error executing\t%s\n"), ERRSTRING);
+		printf("Error executing\t%s\n", ERRSTRING);
 		fflush(stdout);
 		sleep (2);
 	}
@@ -481,29 +479,29 @@ write_user(struct utmp *ut)
 	        return;
 
 	msg[0] = '\007';	/* gettext crashes on \a */
-	sprintf(msg+1, _("URGENT: broadcast message from %s:"), whom);
+	sprintf(msg+1, "URGENT: broadcast message from %s:", whom);
 	WRCRLF;
 	WR(msg);
 	WRCRLF;
 
 	if (hours > 1)
-		sprintf(msg, _("System going down in %d hours %d minutes"),
+		sprintf(msg, "System going down in %d hours %d minutes",
 			hours, minutes);
 	else if (hours == 1)
-		sprintf(msg, _("System going down in 1 hour %d minutes"),
+		sprintf(msg, "System going down in 1 hour %d minutes",
 			minutes);
 	else if (minutes > 1)
-		sprintf(msg, _("System going down in %d minutes\n"),
+		sprintf(msg, "System going down in %d minutes\n",
 			minutes);
 	else if (minutes == 1)
-		sprintf(msg, _("System going down in 1 minute\n"));
+		sprintf(msg, "System going down in 1 minute\n");
 	else
-		sprintf(msg, _("System going down IMMEDIATELY!\n"));
+		sprintf(msg, "System going down IMMEDIATELY!\n");
 
 	WR(msg);
 	WRCRLF;
 
-	sprintf(msg, _("\t... %s ...\n"), message);
+	sprintf(msg, "\t... %s ...\n", message);
 	WR(msg);
 	WRCRLF;
 
@@ -560,7 +558,7 @@ swap_off(void)
 
 	sync();
 	if ((pid = fork()) < 0) {
-		my_puts(_("Cannot fork for swapoff. Shrug!"));
+		my_puts("Cannot fork for swapoff. Shrug!");
 		return;
 	}
 	if (!pid) {
@@ -568,8 +566,8 @@ swap_off(void)
 		execl("/etc/swapoff", SWAPOFF_ARGS, NULL);
 		execl("/bin/swapoff", SWAPOFF_ARGS, NULL);
 		execlp("swapoff", SWAPOFF_ARGS, NULL);
-		my_puts(_("Cannot exec swapoff, "
-			  "hoping umount will do the trick."));
+		my_puts("Cannot exec swapoff, "
+			  "hoping umount will do the trick.");
 		exit(EXIT_SUCCESS);
 	}
 	while ((result = wait(&status)) != -1 && result != pid)
@@ -587,7 +585,7 @@ unmount_disks(void)
 
 	sync();
 	if ((pid = fork()) < 0) {
-		my_puts(_("Cannot fork for umount, trying manually."));
+		my_puts("Cannot fork for umount, trying manually.");
 		unmount_disks_ourselves();
 		return;
 	}
@@ -596,16 +594,16 @@ unmount_disks(void)
 
 		/* need my_printf instead of my_puts here */
 		freopen(_PATH_CONSOLE, "w", stdout);
-		printf(_("Cannot exec %s, trying umount.\n"), _PATH_UMOUNT);
+		printf("Cannot exec %s, trying umount.\n", _PATH_UMOUNT);
 		fflush(stdout);
 
 		execlp("umount", UMOUNT_ARGS, NULL);
-		my_puts(_("Cannot exec umount, giving up on umount."));
+		my_puts("Cannot exec umount, giving up on umount.");
 		exit(EXIT_SUCCESS);
 	}
 	while ((result = wait(&status)) != -1 && result != pid)
 		;
-	my_puts(_("Unmounting any remaining filesystems..."));
+	my_puts("Unmounting any remaining filesystems...");
 	unmount_disks_ourselves();
 }
 
@@ -652,7 +650,7 @@ unmount_disks_ourselves(void)
 		printf("umount %s\n", filesys);
 #else
 		if (umount(mntlist[i]) < 0)
-			printf(_("shutdown: Couldn't umount %s: %s\n"),
+			printf("shutdown: Couldn't umount %s: %s\n",
 			       filesys, ERRSTRING);
 #endif
 	}
simpleinit/simpleinit.c +20 -22

154 lines not on this page · raw message

Signature · 1 line
1.7.3.4
#1 lore raw

There is a little mistake in the commit message, initctl doesn't need changes:

About 50 messages to translate less.

shutdown(1) is deprecated since July 2007, simpleinit(1) is deprecated since December 2010. They are marked as deprecated why nobody uses these implementations.

maintainer
#2 lore raw
In reply to Francesco Cosoleto
Quoted 5 lines · Francesco Cosoleto

About 50 messages to translate less.

shutdown(1) is deprecated since July 2007, simpleinit(1), initctl(1) are deprecated since December 2010. They are marked as deprecated why nobody uses these implementations.

I have committed something completely different:

commit 0ff9e65ea30ee7e3548d11992a180d95d0a02fe9
Author: Karel Zak <[email protected]>
Date: Wed Jun 8 13:20:37 2011 +0200

simpleinit: remove this deprecated set of utils

Makefile.am | 6 +-
configure.ac | 9 -
simpleinit/.gitignore | 3 -
simpleinit/Makefile.am | 27 -
simpleinit/fastboot.8 | 1 -
simpleinit/fasthalt.8 | 1 -
simpleinit/halt.8 | 1 -
simpleinit/initctl.8 | 110 -----
simpleinit/initctl.c | 217 --------
simpleinit/reboot.8 | 1 -
simpleinit/shutdown.8 | 169 -------
simpleinit/shutdown.c | 747 ----------------------------
simpleinit/simpleinit.8 | 180 -------
simpleinit/simpleinit.c | 1251 -----------------------------------------------
simpleinit/simpleinit.h | 28 -
15 files changed, 1 insertions(+), 2750 deletions(-)

:-)

Karel