McdeSys: the printer errors in the catalog, German measured (t0282)
printers.c's eighteen mcde_sys_fail calls are messages 43-56 of mcdesys.cat now: no place for the printers, no CUPS (lpstat/lpadmin), CUPS did not answer or did not take the default printer/the printer/the removal, no printer was named, the default printer / adding / removing needs the administrator, the printer's name and address must be plain, no mDNS browser and the browser did not answer. German copy in programs/localized/de_DE.UTF-8/msg/mcdesys.msg with the same numbers. Measured with a runner (setlocale + the public calls): LANG=C: "The printer's name and address must be plain (letters, digits, - and _; ipp://...)." and "No printer was named."; LANG=de_DE.UTF-8: "Name und Adresse des Druckers müssen schlicht sein (...)" and "Es wurde kein Drucker genannt." make mcde-linux MCDE_DIRS="install lib/McdeSys" and "install programs/localized/C/msg" exit=0; "check lib/McdeSys": # FAIL: 0, exit=0; MCDE_DIRS=plist: ok.
This commit is contained in:
1 parent
22aaaa5d84
commit
b674c3d2b7
4 files changed
+61
-33
No files matched your search
@@ -46,3 +46,17 @@ $set 1
|
||||
40 There is no sound file "%s".
|
||||
41 No player for sounds is installed.
|
||||
42 Cannot start %s.
|
||||
43 There is no place for the printers.
|
||||
44 This system has no CUPS (lpstat).
|
||||
45 CUPS did not answer.
|
||||
46 No printer was named.
|
||||
47 This system has no CUPS administration (lpadmin).
|
||||
48 The default printer needs the administrator.
|
||||
49 CUPS did not take the default printer.
|
||||
50 The printer's name and address must be plain (letters, digits, - and _; ipp://...).
|
||||
51 Adding a printer needs the administrator.
|
||||
52 CUPS did not take the printer (is the address right?).
|
||||
53 Removing a printer needs the administrator.
|
||||
54 CUPS did not take the removal.
|
||||
55 There is no mDNS browser (avahi-browse) on this system.
|
||||
56 The mDNS browser did not answer.
|
||||
+18
-33
@@ -58,16 +58,14 @@ mcde_sys_printers(McdeSysPrinter *list, size_t max)
|
||||
int count = 0, i;
|
||||
|
||||
if (list == NULL)
|
||||
return mcde_sys_fail(MCDE_SYS_EINVAL, "There is no place for "
|
||||
"the printers.");
|
||||
return mcde_sys_fail(MCDE_SYS_EINVAL, mcde_sys_msg(MSG_PRN_NO_PLACE, "There is no place for the printers."));
|
||||
if (lpstat == NULL)
|
||||
return mcde_sys_fail(MCDE_SYS_ENOTSUP, "This system has no "
|
||||
"CUPS (lpstat).");
|
||||
return mcde_sys_fail(MCDE_SYS_ENOTSUP, mcde_sys_msg(MSG_PRN_NO_LPSTAT, "This system has no CUPS (lpstat)."));
|
||||
argv[0] = (char *) lpstat;
|
||||
argv[1] = (char *) "-p";
|
||||
argv[2] = NULL;
|
||||
if (mcde_sys_capture(argv, out, sizeof out) != MCDE_SYS_OK)
|
||||
return mcde_sys_fail(MCDE_SYS_EFAIL, "CUPS did not answer.");
|
||||
return mcde_sys_fail(MCDE_SYS_EFAIL, mcde_sys_msg(MSG_PRN_NO_ANSWER, "CUPS did not answer."));
|
||||
/* "printer NAME is idle. enabled since ..." -- a continuation line
|
||||
* carries a stopped printer's reason */
|
||||
argv[1] = (char *) "-d";
|
||||
@@ -130,20 +128,17 @@ mcde_sys_printer_default(const char *name)
|
||||
|
||||
if (name == NULL || name[0] == '\0' || strchr(name, '/') != NULL ||
|
||||
strchr(name, ' ') != NULL)
|
||||
return mcde_sys_fail(MCDE_SYS_EINVAL, "No printer was named.");
|
||||
return mcde_sys_fail(MCDE_SYS_EINVAL, mcde_sys_msg(MSG_PRN_NO_NAME, "No printer was named."));
|
||||
if (lpadmin == NULL)
|
||||
return mcde_sys_fail(MCDE_SYS_ENOTSUP, "This system has no "
|
||||
"CUPS administration (lpadmin).");
|
||||
return mcde_sys_fail(MCDE_SYS_ENOTSUP, mcde_sys_msg(MSG_PRN_NO_LPADMIN, "This system has no CUPS administration (lpadmin)."));
|
||||
if (geteuid() != 0)
|
||||
return mcde_sys_fail(MCDE_SYS_EPERM, "The default printer "
|
||||
"needs the administrator.");
|
||||
return mcde_sys_fail(MCDE_SYS_EPERM, mcde_sys_msg(MSG_PRN_DEFAULT_EPERM, "The default printer needs the administrator."));
|
||||
argv[0] = (char *) lpadmin;
|
||||
argv[1] = (char *) "-d";
|
||||
argv[2] = (char *) name;
|
||||
argv[3] = NULL;
|
||||
if (mcde_sys_run(argv) != MCDE_SYS_OK)
|
||||
return mcde_sys_fail(MCDE_SYS_EFAIL, "CUPS did not take the "
|
||||
"default printer.");
|
||||
return mcde_sys_fail(MCDE_SYS_EFAIL, mcde_sys_msg(MSG_PRN_DEFAULT_FAIL, "CUPS did not take the default printer."));
|
||||
return MCDE_SYS_OK;
|
||||
}
|
||||
|
||||
@@ -188,15 +183,12 @@ mcde_sys_printer_add(const char *name, const char *uri)
|
||||
char *argv[8];
|
||||
|
||||
if (!NameOk(name) || !UriOk(uri))
|
||||
return mcde_sys_fail(MCDE_SYS_EINVAL, "The printer's name and "
|
||||
"address must be plain (letters, digits, - and _; ipp://...).")
|
||||
return mcde_sys_fail(MCDE_SYS_EINVAL, mcde_sys_msg(MSG_PRN_BAD_NAME, "The printer's name and address must be plain (letters, digits, - and _; ipp://...)."))
|
||||
;
|
||||
if (lpadmin == NULL)
|
||||
return mcde_sys_fail(MCDE_SYS_ENOTSUP, "This system has no "
|
||||
"CUPS administration (lpadmin).");
|
||||
return mcde_sys_fail(MCDE_SYS_ENOTSUP, mcde_sys_msg(MSG_PRN_NO_LPADMIN, "This system has no CUPS administration (lpadmin)."));
|
||||
if (geteuid() != 0)
|
||||
return mcde_sys_fail(MCDE_SYS_EPERM, "Adding a printer needs "
|
||||
"the administrator.");
|
||||
return mcde_sys_fail(MCDE_SYS_EPERM, mcde_sys_msg(MSG_PRN_ADD_EPERM, "Adding a printer needs the administrator."));
|
||||
argv[0] = (char *) lpadmin;
|
||||
argv[1] = (char *) "-p";
|
||||
argv[2] = (char *) name;
|
||||
@@ -207,8 +199,7 @@ mcde_sys_printer_add(const char *name, const char *uri)
|
||||
argv[7] = (char *) "everywhere";
|
||||
argv[8] = NULL;
|
||||
if (mcde_sys_run(argv) != MCDE_SYS_OK)
|
||||
return mcde_sys_fail(MCDE_SYS_EFAIL, "CUPS did not take the "
|
||||
"printer (is the address right?).");
|
||||
return mcde_sys_fail(MCDE_SYS_EFAIL, mcde_sys_msg(MSG_PRN_ADD_FAIL, "CUPS did not take the printer (is the address right?)."));
|
||||
return MCDE_SYS_OK;
|
||||
}
|
||||
|
||||
@@ -221,20 +212,17 @@ mcde_sys_printer_remove(const char *name)
|
||||
char *argv[4];
|
||||
|
||||
if (!NameOk(name))
|
||||
return mcde_sys_fail(MCDE_SYS_EINVAL, "No printer was named.");
|
||||
return mcde_sys_fail(MCDE_SYS_EINVAL, mcde_sys_msg(MSG_PRN_NO_NAME, "No printer was named."));
|
||||
if (lpadmin == NULL)
|
||||
return mcde_sys_fail(MCDE_SYS_ENOTSUP, "This system has no "
|
||||
"CUPS administration (lpadmin).");
|
||||
return mcde_sys_fail(MCDE_SYS_ENOTSUP, mcde_sys_msg(MSG_PRN_NO_LPADMIN, "This system has no CUPS administration (lpadmin)."));
|
||||
if (geteuid() != 0)
|
||||
return mcde_sys_fail(MCDE_SYS_EPERM, "Removing a printer needs "
|
||||
"the administrator.");
|
||||
return mcde_sys_fail(MCDE_SYS_EPERM, mcde_sys_msg(MSG_PRN_REMOVE_EPERM, "Removing a printer needs the administrator."));
|
||||
argv[0] = (char *) lpadmin;
|
||||
argv[1] = (char *) "-x";
|
||||
argv[2] = (char *) name;
|
||||
argv[3] = NULL;
|
||||
if (mcde_sys_run(argv) != MCDE_SYS_OK)
|
||||
return mcde_sys_fail(MCDE_SYS_EFAIL, "CUPS did not take the "
|
||||
"removal.");
|
||||
return mcde_sys_fail(MCDE_SYS_EFAIL, mcde_sys_msg(MSG_PRN_REMOVE_FAIL, "CUPS did not take the removal."));
|
||||
return MCDE_SYS_OK;
|
||||
}
|
||||
|
||||
@@ -294,18 +282,15 @@ mcde_sys_printers_discovered(char (*names)[MCDE_SYS_PRINTER_TEXT],
|
||||
const char *avahi = Tool(where);
|
||||
|
||||
if (names == NULL || uris == NULL)
|
||||
return mcde_sys_fail(MCDE_SYS_EINVAL, "There is no place for "
|
||||
"the printers.");
|
||||
return mcde_sys_fail(MCDE_SYS_EINVAL, mcde_sys_msg(MSG_PRN_NO_PLACE, "There is no place for the printers."));
|
||||
if (avahi == NULL)
|
||||
return mcde_sys_fail(MCDE_SYS_ENOTSUP, "There is no mDNS "
|
||||
"browser (avahi-browse) on this system.");
|
||||
return mcde_sys_fail(MCDE_SYS_ENOTSUP, mcde_sys_msg(MSG_PRN_NO_MDNS, "There is no mDNS browser (avahi-browse) on this system."));
|
||||
argv[0] = (char *) avahi;
|
||||
argv[1] = (char *) "-rtp";
|
||||
argv[2] = (char *) "_ipp._tcp";
|
||||
argv[3] = NULL;
|
||||
if (mcde_sys_capture_limited(argv, out, sizeof out, 4) != MCDE_SYS_OK)
|
||||
return mcde_sys_fail(MCDE_SYS_EFAIL, "The mDNS browser did not "
|
||||
"answer.");
|
||||
return mcde_sys_fail(MCDE_SYS_EFAIL, mcde_sys_msg(MSG_PRN_MDNS_FAIL, "The mDNS browser did not answer."));
|
||||
/* "=;iface;proto;name;type;domain;host;address;port;txt" */
|
||||
for (line = strtok_r(out, "\n", &last); line != NULL;
|
||||
line = strtok_r(NULL, "\n", &last)) {
|
||||
|
||||
@@ -61,6 +61,21 @@ int mcde_sys_fail(int status, const char *fmt, ...);
|
||||
#define MSG_SND_NO_FILE 40
|
||||
#define MSG_SND_NO_PLAYER 41
|
||||
#define MSG_SND_CANNOT_START 42
|
||||
/* printers.c: CUPS, the name of a printer and the mDNS browser */
|
||||
#define MSG_PRN_NO_PLACE 43
|
||||
#define MSG_PRN_NO_LPSTAT 44
|
||||
#define MSG_PRN_NO_ANSWER 45
|
||||
#define MSG_PRN_NO_NAME 46
|
||||
#define MSG_PRN_NO_LPADMIN 47
|
||||
#define MSG_PRN_DEFAULT_EPERM 48
|
||||
#define MSG_PRN_DEFAULT_FAIL 49
|
||||
#define MSG_PRN_BAD_NAME 50
|
||||
#define MSG_PRN_ADD_EPERM 51
|
||||
#define MSG_PRN_ADD_FAIL 52
|
||||
#define MSG_PRN_REMOVE_EPERM 53
|
||||
#define MSG_PRN_REMOVE_FAIL 54
|
||||
#define MSG_PRN_NO_MDNS 55
|
||||
#define MSG_PRN_MDNS_FAIL 56
|
||||
|
||||
const char *mcde_sys_msg(int n, const char *text);
|
||||
/* run ARGV (an absolute path first) and wait; MCDE_SYS_OK on exit status 0 */
|
||||
|
||||
@@ -44,3 +44,17 @@ $set 1
|
||||
40 Es gibt keine Tondatei "%s".
|
||||
41 Es ist kein Abspielprogramm für Töne installiert.
|
||||
42 %s kann nicht gestartet werden.
|
||||
43 Für die Drucker ist kein Platz.
|
||||
44 Dieses System hat kein CUPS (lpstat).
|
||||
45 CUPS hat nicht geantwortet.
|
||||
46 Es wurde kein Drucker genannt.
|
||||
47 Dieses System hat keine CUPS-Verwaltung (lpadmin).
|
||||
48 Der Standarddrucker braucht den Administrator.
|
||||
49 CUPS hat den Standarddrucker nicht angenommen.
|
||||
50 Name und Adresse des Druckers müssen schlicht sein (Buchstaben, Ziffern, - und _; ipp://...).
|
||||
51 Einen Drucker hinzuzufügen braucht den Administrator.
|
||||
52 CUPS hat den Drucker nicht angenommen (stimmt die Adresse?).
|
||||
53 Einen Drucker zu entfernen braucht den Administrator.
|
||||
54 CUPS hat das Entfernen nicht angenommen.
|
||||
55 Es gibt keinen mDNS-Browser (avahi-browse) auf diesem System.
|
||||
56 Der mDNS-Browser hat nicht geantwortet.
|
||||
Reference in new issue
Block a user