add gettext catalog support

This commit is contained in:
Mario Fetka
2026-04-29 19:58:43 +02:00
parent 275ff6cbee
commit d9f0f88b06
55 changed files with 24385 additions and 226 deletions

View File

@@ -54,7 +54,6 @@
#include <time.h>
#include <signal.h>
#include "ipxutil.h"
#include "nls.h"
struct ipx_address
@@ -92,7 +91,7 @@ static IPXNode filter_node;
static const char* progname;
static void usage(void) {
fprintf(stderr, "usage: %s [-r] [-d device] [node]\n", progname);
fprintf(stderr, _("usage: %s [-r] [-d device] [node]\n"), progname);
}
static int exit_request = 0;
@@ -137,7 +136,7 @@ main(int argc, char *argv[])
return 5;
case ':':;
case '?':break;
default: printf("?? unknown option returned by getopt\n");
default: printf(_("?? unknown option returned by getopt\n"));
break;
}
}
@@ -155,7 +154,7 @@ main(int argc, char *argv[])
if ((sd = socket(AF_PACKET, SOCK_RAW, htons(ETH_P_ALL))) < 0)
{
perror("Can't get socket");
fprintf(stderr, "You must run %s as root\n", progname);
fprintf(stderr, _("You must run %s as root\n"), progname);
exit(1);
}
/* SET PROMISC */

View File

@@ -52,7 +52,6 @@
#include <signal.h>
#include <ctype.h>
#include "ipxutil.h"
#include "nls.h"
#define DUMPALLSAPS /* #define if you want to dump all SAP's */
@@ -339,7 +338,7 @@ handle_burst(struct sockaddr_ipx *source,
{
return 0;
}
printf("Burst Packet\n");
printf(_("Burst Packet\n"));
printf("Stream Type: %02X, System Flags: %02X\n",
rq->stream_type, rq->system_flags);
printf("Source Conn: %08X, Dest Conn: %08X, Packet Seq: %08X\n",
@@ -366,7 +365,7 @@ handle_burst(struct sockaddr_ipx *source,
} __attribute__((packed))
*brq = (struct ncp_burst_request *) rq;
printf("Assuming Burst Request:\n");
printf(_("Assuming Burst Request:\n"));
printf("%s: Handle %08X, Offset %08X, Bytes %08X\n",
brq->function == 1 ? "Read " : "Write",
brq->file_handle,
@@ -412,11 +411,11 @@ handle_ncp(struct sockaddr_ipx *source,
{
case 18:
printf("fn: %-3d\n", rq->function);
printf("Get Volume Info with Number\n");
printf(_("Get Volume Info with Number\n"));
break;
case 20:
printf("fn: %-3d\n", rq->function);
printf("Get File Server Date and Time\n");
printf(_("Get File Server Date and Time\n"));
break;
case 21:
printf("fn: %-3d, subfn: %-3d\n",
@@ -424,10 +423,10 @@ handle_ncp(struct sockaddr_ipx *source,
switch (data[2])
{
case 0:
printf("Send Broadcast Message\n");
printf(_("Send Broadcast Message\n"));
break;
case 1:
printf("Get Broadcast Message\n");
printf(_("Get Broadcast Message\n"));
break;
}
data += 3;
@@ -439,25 +438,25 @@ handle_ncp(struct sockaddr_ipx *source,
switch (data[2])
{
case 00:
printf("Set Directory Handle\n");
printf(_("Set Directory Handle\n"));
break;
case 01:
printf("Get Directory Path\n");
printf(_("Get Directory Path\n"));
break;
case 02:
printf("Scan Directory Information\n");
printf(_("Scan Directory Information\n"));
break;
case 03:
printf("Get Effective Directory Rights\n");
printf(_("Get Effective Directory Rights\n"));
break;
case 05:
printf("Get Volume Number\n");
printf(_("Get Volume Number\n"));
break;
case 06:
printf("Get Volume Name\n");
printf(_("Get Volume Name\n"));
break;
case 10:
printf("Create directory\n");
printf(_("Create directory\n"));
break;
case 18:
printf("Allocate Permanent Dir Handle\n");
@@ -484,16 +483,16 @@ handle_ncp(struct sockaddr_ipx *source,
switch (data[2])
{
case 17:
printf("Get Fileserver Information\n");
printf(_("Get Fileserver Information\n"));
break;
case 22:
printf("Get Station's logged Info (old)\n");
break;
case 23:
printf("Get Crypt Key\n");
printf(_("Get Crypt Key\n"));
break;
case 24:
printf("Encrypted Login\n");
printf(_("Encrypted Login\n"));
break;
case 28:
printf("Get Connection Information\n");
@@ -553,11 +552,11 @@ handle_ncp(struct sockaddr_ipx *source,
break;
case 24:
printf("fn: %-3d\n", rq->function);
printf("End of Job\n");
printf(_("End of Job\n"));
break;
case 33:
printf("fn: %-3d\n", rq->function);
printf("Negotiate Buffer size\n");
printf(_("Negotiate Buffer size\n"));
break;
case 34:
printf("fn: %-3d, subfn: %-3d\n", rq->function,
@@ -567,11 +566,11 @@ handle_ncp(struct sockaddr_ipx *source,
break;
case 62:
printf("fn: %-3d\n", rq->function);
printf("File Search Initialize\n");
printf(_("File Search Initialize\n"));
break;
case 63:
printf("fn: %-3d\n", rq->function);
printf("File Search Continue\n");
printf(_("File Search Continue\n"));
break;
case 64:
printf("fn: %-3d\n", rq->function);

22
tools/nls.h Normal file
View File

@@ -0,0 +1,22 @@
#ifndef IPX_UTILS_NLS_H
#define IPX_UTILS_NLS_H
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#if defined(HAVE_LIBINTL_H) && defined(HAVE_GETTEXT)
# include <libintl.h>
#else
# define gettext(String) (String)
#endif
#ifndef _
# define _(String) gettext(String)
#endif
#ifndef N_
# define N_(String) (String)
#endif
#endif /* IPX_UTILS_NLS_H */