Signed-off-by: Jiri Denemark <jdenemar@xxxxxxxxxx> --- tools/virsh-nodedev.c | 62 +++++++------- tools/virsh-nwfilter.c | 27 +++--- tools/virsh-pool.c | 72 ++++++++-------- tools/virsh-secret.c | 22 ++--- tools/virsh-snapshot.c | 46 +++++----- tools/virsh-util.c | 2 +- tools/virsh-volume.c | 78 ++++++++--------- tools/virsh.c | 40 ++++----- tools/virt-admin.c | 54 ++++++------ tools/virt-host-validate-bhyve.c | 4 +- tools/virt-host-validate-common.c | 4 +- tools/virt-host-validate.c | 8 +- tools/virt-login-shell-helper.c | 22 ++--- tools/virt-pki-query-dn.c | 12 +-- tools/vsh.c | 138 +++++++++++++++--------------- tools/vsh.h | 6 +- 16 files changed, 296 insertions(+), 301 deletions(-) diff --git a/tools/virsh-nodedev.c b/tools/virsh-nodedev.c index 5dbec65367..a079c8063b 100644 --- a/tools/virsh-nodedev.c +++ b/tools/virsh-nodedev.c @@ -76,11 +76,11 @@ cmdNodeDeviceCreate(vshControl *ctl, const vshCmd *cmd) flags |= VIR_NODE_DEVICE_CREATE_XML_VALIDATE; if (!(dev = virNodeDeviceCreateXML(priv->conn, buffer, flags))) { - vshError(ctl, _("Failed to create node device from %s"), from); + vshError(ctl, _("Failed to create node device from %1$s"), from); return false; } - vshPrintExtra(ctl, _("Node device %s created from %s\n"), + vshPrintExtra(ctl, _("Node device %1$s created from %2$s\n"), virNodeDeviceGetName(dev), from); return true; } @@ -125,7 +125,7 @@ vshFindNodeDevice(vshControl *ctl, const char *value) if (strchr(value, ',')) { narr = vshStringToArray(value, &arr); if (narr != 2) { - vshError(ctl, _("Malformed device value '%s'"), value); + vshError(ctl, _("Malformed device value '%1$s'"), value); return NULL; } @@ -159,9 +159,9 @@ cmdNodeDeviceDestroy(vshControl *ctl, const vshCmd *cmd) return false; if (virNodeDeviceDestroy(dev) == 0) { - vshPrintExtra(ctl, _("Destroyed node device '%s'\n"), device_value); + vshPrintExtra(ctl, _("Destroyed node device '%1$s'\n"), device_value); } else { - vshError(ctl, _("Failed to destroy node device '%s'"), device_value); + vshError(ctl, _("Failed to destroy node device '%1$s'"), device_value); return false; } @@ -656,7 +656,7 @@ cmdNodeDeviceDetach(vshControl *ctl, const vshCmd *cmd) ignore_value(vshCommandOptStringQuiet(ctl, cmd, "driver", &driverName)); if (!(device = virNodeDeviceLookupByName(priv->conn, name))) { - vshError(ctl, _("Could not find matching device '%s'"), name); + vshError(ctl, _("Could not find matching device '%1$s'"), name); return false; } @@ -672,9 +672,9 @@ cmdNodeDeviceDetach(vshControl *ctl, const vshCmd *cmd) } if (ret) - vshPrintExtra(ctl, _("Device %s detached\n"), name); + vshPrintExtra(ctl, _("Device %1$s detached\n"), name); else - vshError(ctl, _("Failed to detach device %s"), name); + vshError(ctl, _("Failed to detach device %1$s"), name); return ret; } @@ -715,14 +715,14 @@ cmdNodeDeviceReAttach(vshControl *ctl, const vshCmd *cmd) return false; if (!(device = virNodeDeviceLookupByName(priv->conn, name))) { - vshError(ctl, _("Could not find matching device '%s'"), name); + vshError(ctl, _("Could not find matching device '%1$s'"), name); return false; } if (virNodeDeviceReAttach(device) == 0) { - vshPrintExtra(ctl, _("Device %s re-attached\n"), name); + vshPrintExtra(ctl, _("Device %1$s re-attached\n"), name); } else { - vshError(ctl, _("Failed to re-attach device %s"), name); + vshError(ctl, _("Failed to re-attach device %1$s"), name); ret = false; } @@ -765,14 +765,14 @@ cmdNodeDeviceReset(vshControl *ctl, const vshCmd *cmd) return false; if (!(device = virNodeDeviceLookupByName(priv->conn, name))) { - vshError(ctl, _("Could not find matching device '%s'"), name); + vshError(ctl, _("Could not find matching device '%1$s'"), name); return false; } if (virNodeDeviceReset(device) == 0) { - vshPrintExtra(ctl, _("Device %s reset\n"), name); + vshPrintExtra(ctl, _("Device %1$s reset\n"), name); } else { - vshError(ctl, _("Failed to reset device %s"), name); + vshError(ctl, _("Failed to reset device %1$s"), name); ret = false; } @@ -824,11 +824,11 @@ vshEventLifecyclePrint(virConnectPtr conn G_GNUC_UNUSED, if (virTimeStringNowRaw(timestamp) < 0) timestamp[0] = '\0'; - vshPrint(data->ctl, _("%s: event 'lifecycle' for node device %s: %s\n"), + vshPrint(data->ctl, _("%1$s: event 'lifecycle' for node device %2$s: %3$s\n"), timestamp, virNodeDeviceGetName(dev), virshNodeDeviceEventToString(event)); } else { - vshPrint(data->ctl, _("event 'lifecycle' for node device %s: %s\n"), + vshPrint(data->ctl, _("event 'lifecycle' for node device %1$s: %2$s\n"), virNodeDeviceGetName(dev), virshNodeDeviceEventToString(event)); } @@ -853,12 +853,12 @@ vshEventGenericPrint(virConnectPtr conn G_GNUC_UNUSED, if (virTimeStringNowRaw(timestamp) < 0) timestamp[0] = '\0'; - vshPrint(data->ctl, _("%s: event '%s' for node device %s\n"), + vshPrint(data->ctl, _("%1$s: event '%2$s' for node device %3$s\n"), timestamp, data->cb->name, virNodeDeviceGetName(dev)); } else { - vshPrint(data->ctl, _("event '%s' for node device %s\n"), + vshPrint(data->ctl, _("event '%1$s' for node device %2$s\n"), data->cb->name, virNodeDeviceGetName(dev)); } @@ -948,7 +948,7 @@ cmdNodeDeviceEvent(vshControl *ctl, const vshCmd *cmd) if (STREQ(eventName, virshNodeDeviceEventCallbacks[event].name)) break; if (event == VIR_NODE_DEVICE_EVENT_ID_LAST) { - vshError(ctl, _("unknown event type %s"), eventName); + vshError(ctl, _("unknown event type %1$s"), eventName); return false; } @@ -988,7 +988,7 @@ cmdNodeDeviceEvent(vshControl *ctl, const vshCmd *cmd) default: goto cleanup; } - vshPrint(ctl, _("events received: %d\n"), data.count); + vshPrint(ctl, _("events received: %1$d\n"), data.count); if (data.count) ret = true; @@ -1039,11 +1039,11 @@ cmdNodeDeviceUndefine(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) return false; if (virNodeDeviceUndefine(dev, 0) < 0) { - vshError(ctl, _("Failed to undefine node device '%s'"), device_value); + vshError(ctl, _("Failed to undefine node device '%1$s'"), device_value); return false; } - vshPrintExtra(ctl, _("Undefined node device '%s'\n"), device_value); + vshPrintExtra(ctl, _("Undefined node device '%1$s'\n"), device_value); return true; } @@ -1092,11 +1092,11 @@ cmdNodeDeviceDefine(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) flags |= VIR_NODE_DEVICE_DEFINE_XML_VALIDATE; if (!(dev = virNodeDeviceDefineXML(priv->conn, buffer, flags))) { - vshError(ctl, _("Failed to define node device from '%s'"), from); + vshError(ctl, _("Failed to define node device from '%1$s'"), from); return false; } - vshPrintExtra(ctl, _("Node device '%s' defined from '%s'\n"), + vshPrintExtra(ctl, _("Node device '%1$s' defined from '%2$s'\n"), virNodeDeviceGetName(dev), from); return true; } @@ -1137,14 +1137,14 @@ cmdNodeDeviceStart(vshControl *ctl, const vshCmd *cmd) return false; if (!(device = virNodeDeviceLookupByName(priv->conn, name))) { - vshError(ctl, _("Could not find matching device '%s'"), name); + vshError(ctl, _("Could not find matching device '%1$s'"), name); return false; } if (virNodeDeviceCreate(device, 0) == 0) { - vshPrintExtra(ctl, _("Device %s started\n"), name); + vshPrintExtra(ctl, _("Device %1$s started\n"), name); } else { - vshError(ctl, _("Failed to start device %s"), name); + vshError(ctl, _("Failed to start device %1$s"), name); ret = false; } @@ -1198,16 +1198,16 @@ cmdNodeDeviceAutostart(vshControl *ctl, const vshCmd *cmd) if (virNodeDeviceSetAutostart(dev, autostart) < 0) { if (autostart) - vshError(ctl, _("failed to mark device %s as autostarted"), name); + vshError(ctl, _("failed to mark device %1$s as autostarted"), name); else - vshError(ctl, _("failed to unmark device %s as autostarted"), name); + vshError(ctl, _("failed to unmark device %1$s as autostarted"), name); return false; } if (autostart) - vshPrintExtra(ctl, _("Device %s marked as autostarted\n"), name); + vshPrintExtra(ctl, _("Device %1$s marked as autostarted\n"), name); else - vshPrintExtra(ctl, _("Device %s unmarked as autostarted\n"), name); + vshPrintExtra(ctl, _("Device %1$s unmarked as autostarted\n"), name); return true; } diff --git a/tools/virsh-nwfilter.c b/tools/virsh-nwfilter.c index 98380b452d..92b2b7b3bc 100644 --- a/tools/virsh-nwfilter.c +++ b/tools/virsh-nwfilter.c @@ -61,7 +61,7 @@ virshCommandOptNWFilterBy(vshControl *ctl, const vshCmd *cmd, } if (!nwfilter) - vshError(ctl, _("failed to get nwfilter '%s'"), n); + vshError(ctl, _("failed to get nwfilter '%1$s'"), n); return nwfilter; } @@ -114,10 +114,10 @@ cmdNWFilterDefine(vshControl *ctl, const vshCmd *cmd) nwfilter = virNWFilterDefineXML(priv->conn, buffer); if (nwfilter != NULL) { - vshPrintExtra(ctl, _("Network filter %s defined from %s\n"), + vshPrintExtra(ctl, _("Network filter %1$s defined from %2$s\n"), virNWFilterGetName(nwfilter), from); } else { - vshError(ctl, _("Failed to define network filter from %s"), from); + vshError(ctl, _("Failed to define network filter from %1$s"), from); ret = false; } return ret; @@ -157,9 +157,9 @@ cmdNWFilterUndefine(vshControl *ctl, const vshCmd *cmd) return false; if (virNWFilterUndefine(nwfilter) == 0) { - vshPrintExtra(ctl, _("Network filter %s undefined\n"), name); + vshPrintExtra(ctl, _("Network filter %1$s undefined\n"), name); } else { - vshError(ctl, _("Failed to undefine network filter %s"), name); + vshError(ctl, _("Failed to undefine network filter %1$s"), name); ret = false; } @@ -435,9 +435,8 @@ cmdNWFilterEdit(vshControl *ctl, const vshCmd *cmd) #define EDIT_GET_XML virNWFilterGetXMLDesc(nwfilter, 0) #define EDIT_NOT_CHANGED \ do { \ - vshPrintExtra(ctl, _("Network filter %s XML " \ - "configuration not changed.\n"), \ - virNWFilterGetName(nwfilter)); \ + vshPrintExtra(ctl, _("Network filter %1$s XML configuration not changed.\n"), \ + virNWFilterGetName(nwfilter)); \ ret = true; \ goto edit_cleanup; \ } while (0) @@ -445,7 +444,7 @@ cmdNWFilterEdit(vshControl *ctl, const vshCmd *cmd) (nwfilter_edited = virNWFilterDefineXML(priv->conn, doc_edited)) #include "virsh-edit.c" - vshPrintExtra(ctl, _("Network filter %s XML configuration edited.\n"), + vshPrintExtra(ctl, _("Network filter %1$s XML configuration edited.\n"), virNWFilterGetName(nwfilter_edited)); ret = true; @@ -482,7 +481,7 @@ virshCommandOptNWFilterBindingBy(vshControl *ctl, binding = virNWFilterBindingLookupByPortDev(priv->conn, n); if (!binding) - vshError(ctl, _("failed to get nwfilter binding '%s'"), n); + vshError(ctl, _("failed to get nwfilter binding '%1$s'"), n); return binding; } @@ -532,11 +531,11 @@ cmdNWFilterBindingCreate(vshControl *ctl, const vshCmd *cmd) binding = virNWFilterBindingCreateXML(priv->conn, buffer, flags); if (!binding) { - vshError(ctl, _("Failed to create network filter from %s"), from); + vshError(ctl, _("Failed to create network filter from %1$s"), from); return false; } - vshPrintExtra(ctl, _("Network filter binding on %s created from %s\n"), + vshPrintExtra(ctl, _("Network filter binding on %1$s created from %2$s\n"), virNWFilterBindingGetPortDev(binding), from); virNWFilterBindingFree(binding); return true; @@ -577,9 +576,9 @@ cmdNWFilterBindingDelete(vshControl *ctl, const vshCmd *cmd) return false; if (virNWFilterBindingDelete(binding) == 0) { - vshPrintExtra(ctl, _("Network filter binding on %s deleted\n"), portdev); + vshPrintExtra(ctl, _("Network filter binding on %1$s deleted\n"), portdev); } else { - vshError(ctl, _("Failed to delete network filter binding on %s"), portdev); + vshError(ctl, _("Failed to delete network filter binding on %1$s"), portdev); ret = false; } diff --git a/tools/virsh-pool.c b/tools/virsh-pool.c index 8a98c6ae40..56bd414dc9 100644 --- a/tools/virsh-pool.c +++ b/tools/virsh-pool.c @@ -188,7 +188,7 @@ virshCommandOptPoolBy(vshControl *ctl, const vshCmd *cmd, const char *optname, } if (!pool) - vshError(ctl, _("failed to get pool '%s'"), n); + vshError(ctl, _("failed to get pool '%1$s'"), n); return pool; } @@ -230,16 +230,16 @@ cmdPoolAutostart(vshControl *ctl, const vshCmd *cmd) if (virStoragePoolSetAutostart(pool, autostart) < 0) { if (autostart) - vshError(ctl, _("failed to mark pool %s as autostarted"), name); + vshError(ctl, _("failed to mark pool %1$s as autostarted"), name); else - vshError(ctl, _("failed to unmark pool %s as autostarted"), name); + vshError(ctl, _("failed to unmark pool %1$s as autostarted"), name); return false; } if (autostart) - vshPrintExtra(ctl, _("Pool %s marked as autostarted\n"), name); + vshPrintExtra(ctl, _("Pool %1$s marked as autostarted\n"), name); else - vshPrintExtra(ctl, _("Pool %s unmarked as autostarted\n"), name); + vshPrintExtra(ctl, _("Pool %1$s unmarked as autostarted\n"), name); return true; } @@ -299,11 +299,11 @@ cmdPoolCreate(vshControl *ctl, const vshCmd *cmd) return false; if (!(pool = virStoragePoolCreateXML(priv->conn, buffer, flags))) { - vshError(ctl, _("Failed to create pool from %s"), from); + vshError(ctl, _("Failed to create pool from %1$s"), from); return false; } - vshPrintExtra(ctl, _("Pool %s created from %s\n"), + vshPrintExtra(ctl, _("Pool %1$s created from %2$s\n"), virStoragePoolGetName(pool), from); return true; } @@ -492,11 +492,11 @@ cmdPoolCreateAs(vshControl *ctl, const vshCmd *cmd) } if (!(pool = virStoragePoolCreateXML(priv->conn, xml, flags))) { - vshError(ctl, _("Failed to create pool %s"), name); + vshError(ctl, _("Failed to create pool %1$s"), name); return false; } - vshPrintExtra(ctl, _("Pool %s created\n"), name); + vshPrintExtra(ctl, _("Pool %1$s created\n"), name); return true; } @@ -542,11 +542,11 @@ cmdPoolDefine(vshControl *ctl, const vshCmd *cmd) return false; if (!(pool = virStoragePoolDefineXML(priv->conn, buffer, flags))) { - vshError(ctl, _("Failed to define pool from %s"), from); + vshError(ctl, _("Failed to define pool from %1$s"), from); return false; } - vshPrintExtra(ctl, _("Pool %s defined from %s\n"), + vshPrintExtra(ctl, _("Pool %1$s defined from %2$s\n"), virStoragePoolGetName(pool), from); return true; } @@ -582,11 +582,11 @@ cmdPoolDefineAs(vshControl *ctl, const vshCmd *cmd) } if (!(pool = virStoragePoolDefineXML(priv->conn, xml, 0))) { - vshError(ctl, _("Failed to define pool %s"), name); + vshError(ctl, _("Failed to define pool %1$s"), name); return false; } - vshPrintExtra(ctl, _("Pool %s defined\n"), name); + vshPrintExtra(ctl, _("Pool %1$s defined\n"), name); return true; } @@ -629,9 +629,9 @@ cmdPoolBuild(vshControl *ctl, const vshCmd *cmd) flags |= VIR_STORAGE_POOL_BUILD_OVERWRITE; if (virStoragePoolBuild(pool, flags) == 0) { - vshPrintExtra(ctl, _("Pool %s built\n"), name); + vshPrintExtra(ctl, _("Pool %1$s built\n"), name); } else { - vshError(ctl, _("Failed to build pool %s"), name); + vshError(ctl, _("Failed to build pool %1$s"), name); ret = false; } @@ -668,9 +668,9 @@ cmdPoolDestroy(vshControl *ctl, const vshCmd *cmd) return false; if (virStoragePoolDestroy(pool) == 0) { - vshPrintExtra(ctl, _("Pool %s destroyed\n"), name); + vshPrintExtra(ctl, _("Pool %1$s destroyed\n"), name); } else { - vshError(ctl, _("Failed to destroy pool %s"), name); + vshError(ctl, _("Failed to destroy pool %1$s"), name); ret = false; } @@ -707,9 +707,9 @@ cmdPoolDelete(vshControl *ctl, const vshCmd *cmd) return false; if (virStoragePoolDelete(pool, 0) == 0) { - vshPrintExtra(ctl, _("Pool %s deleted\n"), name); + vshPrintExtra(ctl, _("Pool %1$s deleted\n"), name); } else { - vshError(ctl, _("Failed to delete pool %s"), name); + vshError(ctl, _("Failed to delete pool %1$s"), name); ret = false; } @@ -746,9 +746,9 @@ cmdPoolRefresh(vshControl *ctl, const vshCmd *cmd) return false; if (virStoragePoolRefresh(pool, 0) == 0) { - vshPrintExtra(ctl, _("Pool %s refreshed\n"), name); + vshPrintExtra(ctl, _("Pool %1$s refreshed\n"), name); } else { - vshError(ctl, _("Failed to refresh pool %s"), name); + vshError(ctl, _("Failed to refresh pool %1$s"), name); ret = false; } @@ -1174,7 +1174,7 @@ cmdPoolList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) for (i = 0; i < npoolTypes; i++) { if ((poolType = virStoragePoolTypeFromString(poolTypes[i])) < 0) { - vshError(ctl, _("Invalid pool type '%s'"), poolTypes[i]); + vshError(ctl, _("Invalid pool type '%1$s'"), poolTypes[i]); return false; } @@ -1474,7 +1474,7 @@ cmdPoolDiscoverSourcesAs(vshControl * ctl, const vshCmd * cmd G_GNUC_UNUSED) srcList = virConnectFindStoragePoolSources(priv->conn, type, srcSpec, 0); if (srcList == NULL) { - vshError(ctl, _("Failed to find any %s pool sources"), type); + vshError(ctl, _("Failed to find any %1$s pool sources"), type); return false; } vshPrint(ctl, "%s", srcList); @@ -1529,7 +1529,7 @@ cmdPoolDiscoverSources(vshControl * ctl, const vshCmd * cmd G_GNUC_UNUSED) srcList = virConnectFindStoragePoolSources(priv->conn, type, srcSpec, 0); VIR_FREE(srcSpec); if (srcList == NULL) { - vshError(ctl, _("Failed to find any %s pool sources"), type); + vshError(ctl, _("Failed to find any %1$s pool sources"), type); return false; } vshPrint(ctl, "%s", srcList); @@ -1710,9 +1710,9 @@ cmdPoolStart(vshControl *ctl, const vshCmd *cmd) flags |= VIR_STORAGE_POOL_CREATE_WITH_BUILD_NO_OVERWRITE; if (virStoragePoolCreate(pool, flags) == 0) { - vshPrintExtra(ctl, _("Pool %s started\n"), name); + vshPrintExtra(ctl, _("Pool %1$s started\n"), name); } else { - vshError(ctl, _("Failed to start pool %s"), name); + vshError(ctl, _("Failed to start pool %1$s"), name); ret = false; } @@ -1749,9 +1749,9 @@ cmdPoolUndefine(vshControl *ctl, const vshCmd *cmd) return false; if (virStoragePoolUndefine(pool) == 0) { - vshPrintExtra(ctl, _("Pool %s has been undefined\n"), name); + vshPrintExtra(ctl, _("Pool %1$s has been undefined\n"), name); } else { - vshError(ctl, _("Failed to undefine pool %s"), name); + vshError(ctl, _("Failed to undefine pool %1$s"), name); ret = false; } @@ -1840,7 +1840,7 @@ cmdPoolEdit(vshControl *ctl, const vshCmd *cmd) #define EDIT_GET_XML virStoragePoolGetXMLDesc(pool, flags) #define EDIT_NOT_CHANGED \ do { \ - vshPrintExtra(ctl, _("Pool %s XML configuration not changed.\n"), \ + vshPrintExtra(ctl, _("Pool %1$s XML configuration not changed.\n"), \ virStoragePoolGetName(pool)); \ ret = true; \ goto edit_cleanup; \ @@ -1849,7 +1849,7 @@ cmdPoolEdit(vshControl *ctl, const vshCmd *cmd) (pool_edited = virStoragePoolDefineXML(priv->conn, doc_edited, 0)) #include "virsh-edit.c" - vshPrintExtra(ctl, _("Pool %s XML configuration edited.\n"), + vshPrintExtra(ctl, _("Pool %1$s XML configuration edited.\n"), virStoragePoolGetName(pool_edited)); ret = true; @@ -1906,12 +1906,12 @@ vshEventLifecyclePrint(virConnectPtr conn G_GNUC_UNUSED, if (virTimeStringNowRaw(timestamp) < 0) timestamp[0] = '\0'; - vshPrint(data->ctl, _("%s: event 'lifecycle' for storage pool %s: %s\n"), + vshPrint(data->ctl, _("%1$s: event 'lifecycle' for storage pool %2$s: %3$s\n"), timestamp, virStoragePoolGetName(pool), virshPoolEventToString(event)); } else { - vshPrint(data->ctl, _("event 'lifecycle' for storage pool %s: %s\n"), + vshPrint(data->ctl, _("event 'lifecycle' for storage pool %1$s: %2$s\n"), virStoragePoolGetName(pool), virshPoolEventToString(event)); } @@ -1937,12 +1937,12 @@ vshEventGenericPrint(virConnectPtr conn G_GNUC_UNUSED, if (virTimeStringNowRaw(timestamp) < 0) timestamp[0] = '\0'; - vshPrint(data->ctl, _("%s: event '%s' for storage pool %s\n"), + vshPrint(data->ctl, _("%1$s: event '%2$s' for storage pool %3$s\n"), timestamp, data->cb->name, virStoragePoolGetName(pool)); } else { - vshPrint(data->ctl, _("event '%s' for storage pool %s\n"), + vshPrint(data->ctl, _("event '%1$s' for storage pool %2$s\n"), data->cb->name, virStoragePoolGetName(pool)); } @@ -2031,7 +2031,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd) if (STREQ(eventName, virshPoolEventCallbacks[event].name)) break; if (event == VIR_STORAGE_POOL_EVENT_ID_LAST) { - vshError(ctl, _("unknown event type %s"), eventName); + vshError(ctl, _("unknown event type %1$s"), eventName); return false; } @@ -2064,7 +2064,7 @@ cmdPoolEvent(vshControl *ctl, const vshCmd *cmd) default: goto cleanup; } - vshPrint(ctl, _("events received: %d\n"), data.count); + vshPrint(ctl, _("events received: %1$d\n"), data.count); if (data.count) ret = true; diff --git a/tools/virsh-secret.c b/tools/virsh-secret.c index 17d2bbd88d..694e16c5cb 100644 --- a/tools/virsh-secret.c +++ b/tools/virsh-secret.c @@ -53,7 +53,7 @@ virshCommandOptSecret(vshControl *ctl, const vshCmd *cmd, const char **name) secret = virSecretLookupByUUIDString(priv->conn, n); if (secret == NULL) - vshError(ctl, _("failed to get secret '%s'"), n); + vshError(ctl, _("failed to get secret '%1$s'"), n); return secret; } @@ -101,7 +101,7 @@ cmdSecretDefine(vshControl *ctl, const vshCmd *cmd) return false; if (!(res = virSecretDefineXML(priv->conn, buffer, flags))) { - vshError(ctl, _("Failed to set attributes from %s"), from); + vshError(ctl, _("Failed to set attributes from %1$s"), from); goto cleanup; } @@ -110,7 +110,7 @@ cmdSecretDefine(vshControl *ctl, const vshCmd *cmd) goto cleanup; } - vshPrintExtra(ctl, _("Secret %s created\n"), uuid); + vshPrintExtra(ctl, _("Secret %1$s created\n"), uuid); ret = true; cleanup: @@ -387,10 +387,10 @@ cmdSecretUndefine(vshControl *ctl, const vshCmd *cmd) return false; if (virSecretUndefine(secret) < 0) { - vshError(ctl, _("Failed to delete secret %s"), uuid); + vshError(ctl, _("Failed to delete secret %1$s"), uuid); goto cleanup; } - vshPrintExtra(ctl, _("Secret %s deleted\n"), uuid); + vshPrintExtra(ctl, _("Secret %1$s deleted\n"), uuid); ret = true; cleanup: @@ -676,10 +676,10 @@ vshEventLifecyclePrint(virConnectPtr conn G_GNUC_UNUSED, if (virTimeStringNowRaw(timestamp) < 0) timestamp[0] = '\0'; - vshPrint(data->ctl, _("%s: event 'lifecycle' for secret %s: %s\n"), + vshPrint(data->ctl, _("%1$s: event 'lifecycle' for secret %2$s: %3$s\n"), timestamp, uuid, virshSecretEventToString(event)); } else { - vshPrint(data->ctl, _("event 'lifecycle' for secret %s: %s\n"), + vshPrint(data->ctl, _("event 'lifecycle' for secret %1$s: %2$s\n"), uuid, virshSecretEventToString(event)); } @@ -707,12 +707,12 @@ vshEventGenericPrint(virConnectPtr conn G_GNUC_UNUSED, if (virTimeStringNowRaw(timestamp) < 0) timestamp[0] = '\0'; - vshPrint(data->ctl, _("%s: event '%s' for secret %s\n"), + vshPrint(data->ctl, _("%1$s: event '%2$s' for secret %3$s\n"), timestamp, data->cb->name, uuid); } else { - vshPrint(data->ctl, _("event '%s' for secret %s\n"), + vshPrint(data->ctl, _("event '%1$s' for secret %2$s\n"), data->cb->name, uuid); } @@ -799,7 +799,7 @@ cmdSecretEvent(vshControl *ctl, const vshCmd *cmd) if (STREQ(eventName, virshSecretEventCallbacks[event].name)) break; if (event == VIR_SECRET_EVENT_ID_LAST) { - vshError(ctl, _("unknown event type %s"), eventName); + vshError(ctl, _("unknown event type %1$s"), eventName); return false; } @@ -832,7 +832,7 @@ cmdSecretEvent(vshControl *ctl, const vshCmd *cmd) default: goto cleanup; } - vshPrint(ctl, _("events received: %d\n"), data.count); + vshPrint(ctl, _("events received: %1$d\n"), data.count); if (data.count) ret = true; diff --git a/tools/virsh-snapshot.c b/tools/virsh-snapshot.c index 68908cd10a..d7889a38e4 100644 --- a/tools/virsh-snapshot.c +++ b/tools/virsh-snapshot.c @@ -90,9 +90,9 @@ virshSnapshotCreate(vshControl *ctl, virDomainPtr dom, const char *buffer, } if (from) - vshPrintExtra(ctl, _("Domain snapshot %s created from '%s'"), name, from); + vshPrintExtra(ctl, _("Domain snapshot %1$s created from '%2$s'"), name, from); else - vshPrintExtra(ctl, _("Domain snapshot %s created"), name); + vshPrintExtra(ctl, _("Domain snapshot %1$s created"), name); return true; } @@ -238,7 +238,7 @@ virshParseSnapshotMemspec(vshControl *ctl, virBuffer *buf, const char *str) ret = 0; cleanup: if (ret < 0) - vshError(ctl, _("unable to parse memspec: %s"), str); + vshError(ctl, _("unable to parse memspec: %1$s"), str); return ret; } @@ -281,7 +281,7 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBuffer *buf, const char *str) if (STREQ(stype, "block")) { isFile = false; } else if (STRNEQ(stype, "file")) { - vshError(ctl, _("Unknown storage type: '%s'"), stype); + vshError(ctl, _("Unknown storage type: '%1$s'"), stype); goto cleanup; } virBufferAsprintf(buf, " type='%s'", stype); @@ -305,7 +305,7 @@ virshParseSnapshotDiskspec(vshControl *ctl, virBuffer *buf, const char *str) ret = 0; cleanup: if (ret < 0) - vshError(ctl, _("unable to parse diskspec: %s"), str); + vshError(ctl, _("unable to parse diskspec: %1$s"), str); return ret; } @@ -462,7 +462,7 @@ virshLookupSnapshot(vshControl *ctl, const vshCmd *cmd, return -1; if (exclusive && current && snapname) { - vshError(ctl, _("--%s and --current are mutually exclusive"), arg); + vshError(ctl, _("--%1$s and --current are mutually exclusive"), arg); return -1; } @@ -471,7 +471,7 @@ virshLookupSnapshot(vshControl *ctl, const vshCmd *cmd, } else if (current) { *snap = virDomainSnapshotCurrent(dom, 0); } else { - vshError(ctl, _("--%s or --current is required"), arg); + vshError(ctl, _("--%1$s or --current is required"), arg); return -1; } if (!*snap) { @@ -549,7 +549,7 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd) /* Depending on flags, we re-edit even if XML is unchanged. */ \ if (!(define_flags & VIR_DOMAIN_SNAPSHOT_CREATE_CURRENT)) { \ vshPrintExtra(ctl, \ - _("Snapshot %s XML configuration not changed.\n"), \ + _("Snapshot %1$s XML configuration not changed.\n"), \ name); \ ret = true; \ goto edit_cleanup; \ @@ -563,9 +563,9 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd) edited_name = virDomainSnapshotGetName(edited); if (STREQ(name, edited_name)) { - vshPrintExtra(ctl, _("Snapshot %s edited.\n"), name); + vshPrintExtra(ctl, _("Snapshot %1$s edited.\n"), name); } else if (clone_okay) { - vshPrintExtra(ctl, _("Snapshot %s cloned to %s.\n"), name, + vshPrintExtra(ctl, _("Snapshot %1$s cloned to %2$s.\n"), name, edited_name); } else { unsigned int delete_flags; @@ -574,12 +574,12 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd) if (virDomainSnapshotDelete(rename_okay ? snapshot : edited, delete_flags) < 0) { vshReportError(ctl); - vshError(ctl, _("Failed to clean up %s"), + vshError(ctl, _("Failed to clean up %1$s"), rename_okay ? name : edited_name); goto cleanup; } if (!rename_okay) { - vshError(ctl, _("Must use --rename or --clone to change %s to %s"), + vshError(ctl, _("Must use --rename or --clone to change %1$s to %2$s"), name, edited_name); goto cleanup; } @@ -589,7 +589,7 @@ cmdSnapshotEdit(vshControl *ctl, const vshCmd *cmd) cleanup: if (!ret && name) - vshError(ctl, _("Failed to update %s"), name); + vshError(ctl, _("Failed to update %1$s"), name); return ret; } @@ -666,7 +666,7 @@ cmdSnapshotCurrent(vshControl *ctl, const vshCmd *cmd) if (!(snapshot2 = virDomainSnapshotCreateXML(dom, xml, flags))) goto cleanup; - vshPrintExtra(ctl, _("Snapshot %s set as current"), snapshotname); + vshPrintExtra(ctl, _("Snapshot %1$s set as current"), snapshotname); ret = true; goto cleanup; } @@ -675,7 +675,7 @@ cmdSnapshotCurrent(vshControl *ctl, const vshCmd *cmd) goto cleanup; if (!current) { - vshError(ctl, _("domain '%s' has no current snapshot"), domname); + vshError(ctl, _("domain '%1$s' has no current snapshot"), domname); goto cleanup; } else { if (!(snapshot = virDomainSnapshotCurrent(dom, 0))) @@ -1234,7 +1234,7 @@ virshSnapshotListCollect(vshControl *ctl, virDomainPtr dom, * hierarchy isn't huge. XXX Is it worth making O(n^2 log n) * by using qsort and bsearch? */ if (start_index < 0) { - vshError(ctl, _("snapshot %s disappeared from list"), fromname); + vshError(ctl, _("snapshot %1$s disappeared from list"), fromname); goto cleanup; } for (i = 0; i < count; i++) { @@ -1452,7 +1452,7 @@ cmdSnapshotList(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptBool(cmd, option)) { \ if (tree) { \ vshError(ctl, \ - _("--%s and --tree are mutually exclusive"), \ + _("--%1$s and --tree are mutually exclusive"), \ option); \ return false; \ } \ @@ -1695,7 +1695,7 @@ cmdSnapshotParent(vshControl *ctl, const vshCmd *cmd) if (virshGetSnapshotParent(ctl, snapshot, &parent) < 0) return false; if (!parent) { - vshError(ctl, _("snapshot '%s' has no parent"), name); + vshError(ctl, _("snapshot '%1$s' has no parent"), name); return false; } @@ -1784,9 +1784,9 @@ cmdDomainSnapshotRevert(vshControl *ctl, const vshCmd *cmd) } if (result < 0) - vshError(ctl, _("Failed to revert snapshot %s"), name); + vshError(ctl, _("Failed to revert snapshot %1$s"), name); else - vshPrintExtra(ctl, _("Domain snapshot %s reverted\n"), name); + vshPrintExtra(ctl, _("Domain snapshot %1$s reverted\n"), name); return result >= 0; } @@ -1853,14 +1853,14 @@ cmdSnapshotDelete(vshControl *ctl, const vshCmd *cmd) * older servers that reject the flag, by manually computing the * list of descendants. But that's a lot of code to maintain. */ if (virDomainSnapshotDelete(snapshot, flags) < 0) { - vshError(ctl, _("Failed to delete snapshot %s"), name); + vshError(ctl, _("Failed to delete snapshot %1$s"), name); return false; } if (flags & VIR_DOMAIN_SNAPSHOT_DELETE_CHILDREN_ONLY) - vshPrintExtra(ctl, _("Domain snapshot %s children deleted\n"), name); + vshPrintExtra(ctl, _("Domain snapshot %1$s children deleted\n"), name); else - vshPrintExtra(ctl, _("Domain snapshot %s deleted\n"), name); + vshPrintExtra(ctl, _("Domain snapshot %1$s deleted\n"), name); return true; } diff --git a/tools/virsh-util.c b/tools/virsh-util.c index 3c4a084441..61e403a636 100644 --- a/tools/virsh-util.c +++ b/tools/virsh-util.c @@ -63,7 +63,7 @@ virshLookupDomainInternal(vshControl *ctl, vshResetLibvirtError(); if (!dom) - vshError(ctl, _("failed to get domain '%s'"), name); + vshError(ctl, _("failed to get domain '%1$s'"), name); return dom; } diff --git a/tools/virsh-volume.c b/tools/virsh-volume.c index 83e97df2dc..9a2b21d3f3 100644 --- a/tools/virsh-volume.c +++ b/tools/virsh-volume.c @@ -101,7 +101,7 @@ virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd, return NULL; if (virStoragePoolIsActive(pool) != 1) { - vshError(ctl, _("pool '%s' is not active"), p); + vshError(ctl, _("pool '%1$s' is not active"), p); return NULL; } } @@ -133,10 +133,10 @@ virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd, if (!vol) { if (pool || !pooloptname) - vshError(ctl, _("failed to get vol '%s'"), n); + vshError(ctl, _("failed to get vol '%1$s'"), n); else - vshError(ctl, _("failed to get vol '%s', specifying --%s " - "might help"), n, pooloptname); + vshError(ctl, _("failed to get vol '%1$s', specifying --%2$s might help"), + n, pooloptname); } else { vshResetLibvirtError(); } @@ -151,7 +151,7 @@ virshCommandOptVolBy(vshControl *ctl, const vshCmd *cmd, virStoragePoolGetName(pool))) { vshResetLibvirtError(); vshError(ctl, - _("Requested volume '%s' is not in pool '%s'"), + _("Requested volume '%1$s' is not in pool '%2$s'"), n, virStoragePoolGetName(pool)); g_clear_pointer(&vol, virshStorageVolFree); } @@ -252,13 +252,13 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) return false; if (virshVolSize(capacityStr, &capacity) < 0) { - vshError(ctl, _("Malformed size %s"), capacityStr); + vshError(ctl, _("Malformed size %1$s"), capacityStr); return false; } if (vshCommandOptStringQuiet(ctl, cmd, "allocation", &allocationStr) > 0 && virshVolSize(allocationStr, &allocation) < 0) { - vshError(ctl, _("Malformed size %s"), allocationStr); + vshError(ctl, _("Malformed size %1$s"), allocationStr); return false; } @@ -323,7 +323,7 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) cmd->def->name, snapshotStrVol); } if (snapVol == NULL) { - vshError(ctl, _("failed to get vol '%s'"), snapshotStrVol); + vshError(ctl, _("failed to get vol '%1$s'"), snapshotStrVol); return false; } @@ -351,10 +351,10 @@ cmdVolCreateAs(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%s", xml); } else { if (!(vol = virStorageVolCreateXML(pool, xml, flags))) { - vshError(ctl, _("Failed to create vol %s"), name); + vshError(ctl, _("Failed to create vol %1$s"), name); return false; } - vshPrintExtra(ctl, _("Vol %s created\n"), name); + vshPrintExtra(ctl, _("Vol %1$s created\n"), name); } return true; @@ -414,11 +414,11 @@ cmdVolCreate(vshControl *ctl, const vshCmd *cmd) } if (!(vol = virStorageVolCreateXML(pool, buffer, flags))) { - vshError(ctl, _("Failed to create vol from %s"), from); + vshError(ctl, _("Failed to create vol from %1$s"), from); return false; } - vshPrintExtra(ctl, _("Vol %s created from %s\n"), + vshPrintExtra(ctl, _("Vol %1$s created from %2$s\n"), virStorageVolGetName(vol), from); return true; } @@ -496,11 +496,11 @@ cmdVolCreateFrom(vshControl *ctl, const vshCmd *cmd) newvol = virStorageVolCreateXMLFrom(pool, buffer, inputvol, flags); if (!newvol) { - vshError(ctl, _("Failed to create vol from %s"), from); + vshError(ctl, _("Failed to create vol from %1$s"), from); return false; } - vshPrintExtra(ctl, _("Vol %s created from input vol %s\n"), + vshPrintExtra(ctl, _("Vol %1$s created from input vol %2$s\n"), virStorageVolGetName(newvol), virStorageVolGetName(inputvol)); return true; } @@ -603,12 +603,12 @@ cmdVolClone(vshControl *ctl, const vshCmd *cmd) } if (!(newvol = virStorageVolCreateXMLFrom(origpool, newxml, origvol, flags))) { - vshError(ctl, _("Failed to clone vol from %s"), + vshError(ctl, _("Failed to clone vol from %1$s"), virStorageVolGetName(origvol)); return false; } - vshPrintExtra(ctl, _("Vol %s cloned from %s\n"), + vshPrintExtra(ctl, _("Vol %1$s cloned from %2$s\n"), virStorageVolGetName(newvol), virStorageVolGetName(origvol)); return true; } @@ -672,12 +672,12 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd) return false; if ((fd = open(file, O_RDONLY)) < 0) { - vshError(ctl, _("cannot read %s"), file); + vshError(ctl, _("cannot read %1$s"), file); return false; } if (fstat(fd, &sb) < 0) { - vshError(ctl, _("unable to stat %s"), file); + vshError(ctl, _("unable to stat %1$s"), file); return false; } @@ -694,7 +694,7 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd) } if (virStorageVolUpload(vol, st, offset, length, flags) < 0) { - vshError(ctl, _("cannot upload to volume %s"), name); + vshError(ctl, _("cannot upload to volume %1$s"), name); return false; } @@ -702,24 +702,24 @@ cmdVolUpload(vshControl *ctl, const vshCmd *cmd) if (virStreamSparseSendAll(st, virshStreamSource, virshStreamInData, virshStreamSourceSkip, &cbData) < 0) { - vshError(ctl, _("cannot send data to volume %s"), name); + vshError(ctl, _("cannot send data to volume %1$s"), name); return false; } } else { if (virStreamSendAll(st, virshStreamSource, &cbData) < 0) { - vshError(ctl, _("cannot send data to volume %s"), name); + vshError(ctl, _("cannot send data to volume %1$s"), name); return false; } } if (VIR_CLOSE(fd) < 0) { - vshError(ctl, _("cannot close file %s"), file); + vshError(ctl, _("cannot close file %1$s"), file); virStreamAbort(st); return false; } if (virStreamFinish(st) < 0) { - vshError(ctl, _("cannot close volume %s"), name); + vshError(ctl, _("cannot close volume %1$s"), name); return false; } @@ -792,7 +792,7 @@ cmdVolDownload(vshControl *ctl, const vshCmd *cmd) if ((fd = open(file, O_WRONLY|O_CREAT|O_EXCL, 0666)) < 0) { if (errno != EEXIST || (fd = open(file, O_WRONLY|O_TRUNC, 0666)) < 0) { - vshError(ctl, _("cannot create %s"), file); + vshError(ctl, _("cannot create %1$s"), file); goto cleanup; } } else { @@ -800,7 +800,7 @@ cmdVolDownload(vshControl *ctl, const vshCmd *cmd) } if (fstat(fd, &sb) < 0) { - vshError(ctl, _("unable to stat %s"), file); + vshError(ctl, _("unable to stat %1$s"), file); goto cleanup; } @@ -814,23 +814,23 @@ cmdVolDownload(vshControl *ctl, const vshCmd *cmd) } if (virStorageVolDownload(vol, st, offset, length, flags) < 0) { - vshError(ctl, _("cannot download from volume %s"), name); + vshError(ctl, _("cannot download from volume %1$s"), name); goto cleanup; } if (virStreamSparseRecvAll(st, virshStreamSink, virshStreamSkip, &cbData) < 0) { - vshError(ctl, _("cannot receive data from volume %s"), name); + vshError(ctl, _("cannot receive data from volume %1$s"), name); goto cleanup; } if (VIR_CLOSE(fd) < 0) { - vshError(ctl, _("cannot close file %s"), file); + vshError(ctl, _("cannot close file %1$s"), file); virStreamAbort(st); goto cleanup; } if (virStreamFinish(st) < 0) { - vshError(ctl, _("cannot close volume %s"), name); + vshError(ctl, _("cannot close volume %1$s"), name); goto cleanup; } @@ -882,9 +882,9 @@ cmdVolDelete(vshControl *ctl, const vshCmd *cmd) flags |= VIR_STORAGE_VOL_DELETE_WITH_SNAPSHOTS; if (virStorageVolDelete(vol, flags) == 0) { - vshPrintExtra(ctl, _("Vol %s deleted\n"), name); + vshPrintExtra(ctl, _("Vol %1$s deleted\n"), name); } else { - vshError(ctl, _("Failed to delete vol %s"), name); + vshError(ctl, _("Failed to delete vol %1$s"), name); ret = false; } @@ -937,7 +937,7 @@ cmdVolWipe(vshControl *ctl, const vshCmd *cmd) if (algorithm_str && (algorithm = virshStorageVolWipeAlgorithmTypeFromString(algorithm_str)) < 0) { - vshError(ctl, _("Unsupported algorithm '%s'"), algorithm_str); + vshError(ctl, _("Unsupported algorithm '%1$s'"), algorithm_str); return false; } @@ -948,11 +948,11 @@ cmdVolWipe(vshControl *ctl, const vshCmd *cmd) } if (funcRet < 0) { - vshError(ctl, _("Failed to wipe vol %s"), name); + vshError(ctl, _("Failed to wipe vol %1$s"), name); return false; } - vshPrintExtra(ctl, _("Vol %s wiped\n"), name); + vshPrintExtra(ctl, _("Vol %1$s wiped\n"), name); return true; } @@ -1131,21 +1131,21 @@ cmdVolResize(vshControl *ctl, const vshCmd *cmd) flags |= VIR_STORAGE_VOL_RESIZE_DELTA; if (virshVolSize(capacityStr, &capacity) < 0) { - vshError(ctl, _("Malformed size %s"), capacityStr); + vshError(ctl, _("Malformed size %1$s"), capacityStr); return false; } if (virStorageVolResize(vol, capacity, flags) < 0) { vshError(ctl, - delta ? _("Failed to change size of volume '%s' by %s") - : _("Failed to change size of volume '%s' to %s"), + delta ? _("Failed to change size of volume '%1$s' by %2$s") + : _("Failed to change size of volume '%1$s' to %2$s"), virStorageVolGetName(vol), capacityStr); return false; } vshPrintExtra(ctl, - delta ? _("Size of volume '%s' successfully changed by %s\n") - : _("Size of volume '%s' successfully changed to %s\n"), + delta ? _("Size of volume '%1$s' successfully changed by %2$s\n") + : _("Size of volume '%1$s' successfully changed to %2$s\n"), virStorageVolGetName(vol), capacityStr); return true; } diff --git a/tools/virsh.c b/tools/virsh.c index 8de85f2516..963e886860 100644 --- a/tools/virsh.c +++ b/tools/virsh.c @@ -82,13 +82,13 @@ virshCatchDisconnect(virConnectPtr conn, switch ((virConnectCloseReason) reason) { case VIR_CONNECT_CLOSE_REASON_ERROR: - str = N_("Disconnected from %s due to I/O error"); + str = N_("Disconnected from %1$s due to I/O error"); break; case VIR_CONNECT_CLOSE_REASON_EOF: - str = N_("Disconnected from %s due to end of file"); + str = N_("Disconnected from %1$s due to end of file"); break; case VIR_CONNECT_CLOSE_REASON_KEEPALIVE: - str = N_("Disconnected from %s due to keepalive timeout"); + str = N_("Disconnected from %1$s due to keepalive timeout"); break; case VIR_CONNECT_CLOSE_REASON_CLIENT: case VIR_CONNECT_CLOSE_REASON_LAST: @@ -439,8 +439,8 @@ virshUsage(void) const vshCmdGrp *grp; const vshCmdDef *cmd; - fprintf(stdout, _("\n%s [options]... [<command_string>]" - "\n%s [options]... <command> [args...]\n\n" + fprintf(stdout, _("\n%1$s [options]... [<command_string>]" + "\n%2$s [options]... <command> [args...]\n\n" " options:\n" " -c | --connect=URI hypervisor connection URI\n" " -d | --debug=NUM debug level [0-4]\n" @@ -461,7 +461,7 @@ virshUsage(void) progname); for (grp = cmdGroups; grp->name; grp++) { - fprintf(stdout, _(" %s (help keyword '%s')\n"), + fprintf(stdout, _(" %1$s (help keyword '%2$s')\n"), grp->name, grp->keyword); for (cmd = grp->commands; cmd->name; cmd++) { if (cmd->flags & VSH_CMD_FLAG_ALIAS || @@ -488,8 +488,8 @@ static void virshShowVersion(vshControl *ctl G_GNUC_UNUSED) { /* FIXME - list a copyright blurb, as in GNU programs? */ - vshPrint(ctl, _("Virsh command line tool of libvirt %s\n"), VERSION); - vshPrint(ctl, _("See web site at %s\n\n"), "https://libvirt.org/"); + vshPrint(ctl, _("Virsh command line tool of libvirt %1$s\n"), VERSION); + vshPrint(ctl, _("See web site at %1$s\n\n"), "https://libvirt.org/"); vshPrint(ctl, "%s", _("Compiled with support for:\n")); vshPrint(ctl, "%s", _(" Hypervisors:")); @@ -666,12 +666,12 @@ virshParseArgv(vshControl *ctl, int argc, char **argv) break; case 'd': if (virStrToLong_i(optarg, NULL, 10, &debug) < 0) { - vshError(ctl, _("option %s takes a numeric argument"), + vshError(ctl, _("option %1$s takes a numeric argument"), longindex == -1 ? "-d" : "--debug"); exit(EXIT_FAILURE); } if (debug < VSH_ERR_DEBUG || debug > VSH_ERR_ERROR) - vshError(ctl, _("ignoring debug level %d out of range [%d-%d]"), + vshError(ctl, _("ignoring debug level %1$d out of range [%2$d-%3$d]"), debug, VSH_ERR_DEBUG, VSH_ERR_ERROR); else ctl->debug = debug; @@ -684,7 +684,7 @@ virshParseArgv(vshControl *ctl, int argc, char **argv) (len == 1 && *optarg != '^')) { priv->escapeChar = optarg; } else { - vshError(ctl, _("Invalid string '%s' for escape sequence"), + vshError(ctl, _("Invalid string '%1$s' for escape sequence"), optarg); exit(EXIT_FAILURE); } @@ -696,14 +696,14 @@ virshParseArgv(vshControl *ctl, int argc, char **argv) case 'k': if (virStrToLong_i(optarg, NULL, 0, &keepalive) < 0) { vshError(ctl, - _("Invalid value for option %s"), + _("Invalid value for option %1$s"), longindex == -1 ? "-k" : "--keepalive-interval"); exit(EXIT_FAILURE); } if (keepalive < 0) { vshError(ctl, - _("option %s requires a positive integer argument"), + _("option %1$s requires a positive integer argument"), longindex == -1 ? "-k" : "--keepalive-interval"); exit(EXIT_FAILURE); } @@ -712,14 +712,14 @@ virshParseArgv(vshControl *ctl, int argc, char **argv) case 'K': if (virStrToLong_i(optarg, NULL, 0, &keepalive) < 0) { vshError(ctl, - _("Invalid value for option %s"), + _("Invalid value for option %1$s"), longindex == -1 ? "-K" : "--keepalive-count"); exit(EXIT_FAILURE); } if (keepalive < 0) { vshError(ctl, - _("option %s requires a positive integer argument"), + _("option %1$s requires a positive integer argument"), longindex == -1 ? "-K" : "--keepalive-count"); exit(EXIT_FAILURE); } @@ -754,16 +754,16 @@ virshParseArgv(vshControl *ctl, int argc, char **argv) break; } if (opt[i].name) - vshError(ctl, _("option '-%c'/'--%s' requires an argument"), + vshError(ctl, _("option '-%1$c'/'--%2$s' requires an argument"), optopt, opt[i].name); else - vshError(ctl, _("option '-%c' requires an argument"), optopt); + vshError(ctl, _("option '-%1$c' requires an argument"), optopt); exit(EXIT_FAILURE); case '?': if (optopt) - vshError(ctl, _("unsupported option '-%c'. See --help."), optopt); + vshError(ctl, _("unsupported option '-%1$c'. See --help."), optopt); else - vshError(ctl, _("unsupported option '%s'. See --help."), argv[optind - 1]); + vshError(ctl, _("unsupported option '%1$s'. See --help."), argv[optind - 1]); exit(EXIT_FAILURE); default: vshError(ctl, _("unknown option")); @@ -901,7 +901,7 @@ main(int argc, char **argv) /* interactive mode */ if (!ctl->quiet) { vshPrint(ctl, - _("Welcome to %s, the virtualization interactive terminal.\n\n"), + _("Welcome to %1$s, the virtualization interactive terminal.\n\n"), progname); vshPrint(ctl, "%s", _("Type: 'help' for help with commands\n" diff --git a/tools/virt-admin.c b/tools/virt-admin.c index 8baf9636d3..43c91097a3 100644 --- a/tools/virt-admin.c +++ b/tools/virt-admin.c @@ -83,13 +83,13 @@ vshAdmCatchDisconnect(virAdmConnectPtr conn G_GNUC_UNUSED, switch ((virConnectCloseReason) reason) { case VIR_CONNECT_CLOSE_REASON_ERROR: - str = N_("Disconnected from %s due to I/O error"); + str = N_("Disconnected from %1$s due to I/O error"); break; case VIR_CONNECT_CLOSE_REASON_EOF: - str = N_("Disconnected from %s due to end of file"); + str = N_("Disconnected from %1$s due to end of file"); break; case VIR_CONNECT_CLOSE_REASON_KEEPALIVE: - str = N_("Disconnected from %s due to keepalive timeout"); + str = N_("Disconnected from %1$s due to keepalive timeout"); break; case VIR_CONNECT_CLOSE_REASON_CLIENT: case VIR_CONNECT_CLOSE_REASON_LAST: @@ -226,7 +226,7 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) includeVersion %= 1000000; minor = includeVersion / 1000; rel = includeVersion % 1000; - vshPrint(ctl, _("Compiled against library: libvirt %d.%d.%d\n"), + vshPrint(ctl, _("Compiled against library: libvirt %1$d.%2$d.%3$d\n"), major, minor, rel); ret = virGetVersion(&libVersion, NULL, NULL); @@ -238,7 +238,7 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) libVersion %= 1000000; minor = libVersion / 1000; rel = libVersion % 1000; - vshPrint(ctl, _("Using library: libvirt %d.%d.%d\n"), + vshPrint(ctl, _("Using library: libvirt %1$d.%2$d.%3$d\n"), major, minor, rel); ret = virAdmConnectGetLibVersion(priv->conn, &daemonVersion); @@ -249,7 +249,7 @@ cmdVersion(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) daemonVersion %= 1000000; minor = daemonVersion / 1000; rel = daemonVersion % 1000; - vshPrint(ctl, _("Running against daemon: %d.%d.%d\n"), + vshPrint(ctl, _("Running against daemon: %1$d.%2$d.%3$d\n"), major, minor, rel); } @@ -333,7 +333,7 @@ cmdSrvList(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) /* Obtain a list of available servers on the daemon */ if ((nsrvs = virAdmConnectListServers(priv->conn, &srvs, 0)) < 0) { uri = virAdmConnectGetURI(priv->conn); - vshError(ctl, _("failed to obtain list of available servers from %s"), + vshError(ctl, _("failed to obtain list of available servers from %1$s"), NULLSTR(uri)); goto cleanup; } @@ -484,7 +484,7 @@ cmdSrvThreadpoolSet(vshControl *ctl, const vshCmd *cmd) #define PARSE_CMD_TYPED_PARAM(NAME, FIELD) \ if ((rv = vshCommandOptUInt(ctl, cmd, NAME, &val)) < 0) { \ - vshError(ctl, _("Unable to parse integer parameter '%s'"), NAME); \ + vshError(ctl, _("Unable to parse integer parameter '%1$s'"), NAME); \ goto cleanup; \ } else if (rv > 0) { \ if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, \ @@ -584,8 +584,8 @@ cmdSrvClientsList(vshControl *ctl, const vshCmd *cmd) /* Obtain a list of clients connected to server @srv */ if ((nclts = virAdmServerListClients(srv, &clts, 0)) < 0) { - vshError(ctl, _("failed to obtain list of connected clients " - "from server '%s'"), virAdmServerGetName(srv)); + vshError(ctl, _("failed to obtain list of connected clients from server '%1$s'"), + virAdmServerGetName(srv)); goto cleanup; } @@ -681,8 +681,7 @@ cmdClientInfo(vshControl *ctl, const vshCmd *cmd) /* Retrieve client identity info */ if (virAdmClientGetInfo(clnt, ¶ms, &nparams, 0) < 0) { - vshError(ctl, _("failed to retrieve client identity information for " - "client '%llu' connected to server '%s'"), + vshError(ctl, _("failed to retrieve client identity information for client '%1$llu' connected to server '%2$s'"), id, virAdmServerGetName(srv)); goto cleanup; } @@ -765,12 +764,12 @@ cmdClientDisconnect(vshControl *ctl, const vshCmd *cmd) goto cleanup; if (virAdmClientClose(client, 0) < 0) { - vshError(ctl, _("Failed to disconnect client '%llu' from server %s"), + vshError(ctl, _("Failed to disconnect client '%1$llu' from server %2$s"), id, virAdmServerGetName(srv)); goto cleanup; } - vshPrint(ctl, _("Client '%llu' disconnected"), id); + vshPrint(ctl, _("Client '%1$llu' disconnected"), id); ret = true; cleanup: virAdmClientFree(client); @@ -891,7 +890,7 @@ cmdSrvClientsSet(vshControl *ctl, const vshCmd *cmd) #define PARSE_CMD_TYPED_PARAM(NAME, FIELD) \ if ((rv = vshCommandOptUInt(ctl, cmd, NAME, &val)) < 0) { \ - vshError(ctl, _("Unable to parse integer parameter '%s'"), NAME); \ + vshError(ctl, _("Unable to parse integer parameter '%1$s'"), NAME); \ goto cleanup; \ } else if (rv > 0) { \ if (virTypedParamsAddUInt(¶ms, &nparams, &maxparams, \ @@ -1250,8 +1249,8 @@ vshAdmUsage(void) const vshCmdGrp *grp; const vshCmdDef *cmd; - fprintf(stdout, _("\n%s [options]... [<command_string>]" - "\n%s [options]... <command> [args...]\n\n" + fprintf(stdout, _("\n%1$s [options]... [<command_string>]" + "\n%2$s [options]... <command> [args...]\n\n" " options:\n" " -c | --connect=URI daemon admin connection URI\n" " -d | --debug=NUM debug level [0-4]\n" @@ -1265,7 +1264,7 @@ vshAdmUsage(void) progname); for (grp = cmdGroups; grp->name; grp++) { - fprintf(stdout, _(" %s (help keyword '%s')\n"), + fprintf(stdout, _(" %1$s (help keyword '%2$s')\n"), grp->name, grp->keyword); for (cmd = grp->commands; cmd->name; cmd++) { if (cmd->flags & VSH_CMD_FLAG_ALIAS || @@ -1292,8 +1291,8 @@ static void vshAdmShowVersion(vshControl *ctl G_GNUC_UNUSED) { /* FIXME - list a copyright blurb, as in GNU programs? */ - vshPrint(ctl, _("Virt-admin command line tool of libvirt %s\n"), VERSION); - vshPrint(ctl, _("See web site at %s\n\n"), "https://libvirt.org/"); + vshPrint(ctl, _("Virt-admin command line tool of libvirt %1$s\n"), VERSION); + vshPrint(ctl, _("See web site at %1$s\n\n"), "https://libvirt.org/"); vshPrint(ctl, "%s", _("Compiled with support for:")); #ifdef WITH_LIBVIRTD @@ -1333,12 +1332,12 @@ vshAdmParseArgv(vshControl *ctl, int argc, char **argv) break; case 'd': if (virStrToLong_i(optarg, NULL, 10, &debug) < 0) { - vshError(ctl, _("option %s takes a numeric argument"), + vshError(ctl, _("option %1$s takes a numeric argument"), longindex == -1 ? "-d" : "--debug"); exit(EXIT_FAILURE); } if (debug < VSH_ERR_DEBUG || debug > VSH_ERR_ERROR) - vshError(ctl, _("ignoring debug level %d out of range [%d-%d]"), + vshError(ctl, _("ignoring debug level %1$d out of range [%2$d-%3$d]"), debug, VSH_ERR_DEBUG, VSH_ERR_ERROR); else ctl->debug = debug; @@ -1370,16 +1369,16 @@ vshAdmParseArgv(vshControl *ctl, int argc, char **argv) break; } if (opt[i].name) - vshError(ctl, _("option '-%c'/'--%s' requires an argument"), + vshError(ctl, _("option '-%1$c'/'--%2$s' requires an argument"), optopt, opt[i].name); else - vshError(ctl, _("option '-%c' requires an argument"), optopt); + vshError(ctl, _("option '-%1$c' requires an argument"), optopt); exit(EXIT_FAILURE); case '?': if (optopt) - vshError(ctl, _("unsupported option '-%c'. See --help."), optopt); + vshError(ctl, _("unsupported option '-%1$c'. See --help."), optopt); else - vshError(ctl, _("unsupported option '%s'. See --help."), argv[optind - 1]); + vshError(ctl, _("unsupported option '%1$s'. See --help."), argv[optind - 1]); exit(EXIT_FAILURE); default: vshError(ctl, _("unknown option")); @@ -1616,8 +1615,7 @@ main(int argc, char **argv) /* interactive mode */ if (!ctl->quiet) { vshPrint(ctl, - _("Welcome to %s, the administrating virtualization " - "interactive terminal.\n\n"), + _("Welcome to %1$s, the administrating virtualization interactive terminal.\n\n"), progname); vshPrint(ctl, "%s", _("Type: 'help' for help with commands\n" diff --git a/tools/virt-host-validate-bhyve.c b/tools/virt-host-validate-bhyve.c index 2f0ec1e36c..a39225016d 100644 --- a/tools/virt-host-validate-bhyve.c +++ b/tools/virt-host-validate-bhyve.c @@ -28,12 +28,12 @@ #include "virt-host-validate-common.h" #define MODULE_STATUS(mod, err_msg, err_code) \ - virHostMsgCheck("BHYVE", _("for %s module"), #mod); \ + virHostMsgCheck("BHYVE", _("for %1$s module"), #mod); \ if (mod ## _loaded) { \ virHostMsgPass(); \ } else { \ virHostMsgFail(err_code, \ - _("%s module is not loaded, " err_msg), \ + _("%1$s module is not loaded, " err_msg), \ #mod); \ ret = -1; \ } diff --git a/tools/virt-host-validate-common.c b/tools/virt-host-validate-common.c index a41bb346d2..64a5786e0b 100644 --- a/tools/virt-host-validate-common.c +++ b/tools/virt-host-validate-common.c @@ -65,7 +65,7 @@ void virHostMsgCheck(const char *prefix, msg = g_strdup_vprintf(format, args); va_end(args); - fprintf(stdout, _("%6s: Checking %-60s: "), prefix, msg); + fprintf(stdout, _("%1$6s: Checking %2$-60s: "), prefix, msg); } static bool virHostMsgWantEscape(void) @@ -255,7 +255,7 @@ int virHostValidateLinuxKernel(const char *hvname, uname(&uts); - virHostMsgCheck(hvname, _("for Linux >= %d.%d.%d"), + virHostMsgCheck(hvname, _("for Linux >= %1$d.%2$d.%3$d"), ((version >> 16) & 0xff), ((version >> 8) & 0xff), (version & 0xff)); diff --git a/tools/virt-host-validate.c b/tools/virt-host-validate.c index 52ca729f85..d9fa52c310 100644 --- a/tools/virt-host-validate.c +++ b/tools/virt-host-validate.c @@ -49,7 +49,7 @@ show_help(FILE *out, const char *argv0) { fprintf(out, _("\n" - "syntax: %s [OPTIONS] [HVTYPE]\n" + "syntax: %1$s [OPTIONS] [HVTYPE]\n" "\n" " Hypervisor types:\n" "\n" @@ -90,7 +90,7 @@ main(int argc, char **argv) if (virGettextInitialize() < 0 || virErrorInitialize() < 0) { - fprintf(stderr, _("%s: initialization failed\n"), argv[0]); + fprintf(stderr, _("%1$s: initialization failed\n"), argv[0]); return EXIT_FAILURE; } @@ -116,7 +116,7 @@ main(int argc, char **argv) } if ((argc-optind) > 2) { - fprintf(stderr, _("%s: too many command line arguments\n"), argv[0]); + fprintf(stderr, _("%1$s: too many command line arguments\n"), argv[0]); show_help(stderr, argv[0]); return EXIT_FAILURE; } @@ -159,7 +159,7 @@ main(int argc, char **argv) #endif if (hvname && !usedHvname) { - fprintf(stderr, _("%s: unsupported hypervisor name %s\n"), + fprintf(stderr, _("%1$s: unsupported hypervisor name %2$s\n"), argv[0], hvname); return EXIT_FAILURE; } diff --git a/tools/virt-login-shell-helper.c b/tools/virt-login-shell-helper.c index 8feeb8f0fe..cb94c49720 100644 --- a/tools/virt-login-shell-helper.c +++ b/tools/virt-login-shell-helper.c @@ -80,7 +80,7 @@ static int virLoginShellAllowedUser(virConf *conf, } } virReportSystemError(EPERM, - _("%s not matched against 'allowed_users' in %s"), + _("%1$s not matched against 'allowed_users' in %2$s"), name, conf_file); cleanup: VIR_FREE(gname); @@ -118,7 +118,7 @@ usage(void) fprintf(stdout, _("\n" "Usage:\n" - " %s [option]\n\n" + " %1$s [option]\n\n" "Options:\n" " -h | --help Display program help\n" " -V | --version Display program version\n" @@ -196,12 +196,12 @@ main(int argc, char **argv) return ret; if (geteuid() != 0) { - fprintf(stderr, _("%s: must be run as root\n"), argv[0]); + fprintf(stderr, _("%1$s: must be run as root\n"), argv[0]); return ret; } if (getuid() != 0) { - fprintf(stderr, _("%s: must not be run setuid root\n"), argv[0]); + fprintf(stderr, _("%1$s: must not be run setuid root\n"), argv[0]); return ret; } @@ -227,13 +227,13 @@ main(int argc, char **argv) } if (optind != (argc - 2)) { - virReportSystemError(EINVAL, _("%s expects UID and GID parameters"), progname); + virReportSystemError(EINVAL, _("%1$s expects UID and GID parameters"), progname); goto cleanup; } if (virStrToLong_ull(argv[optind], NULL, 10, &uidval) < 0 || ((uid_t)uidval) != uidval) { - virReportSystemError(EINVAL, _("%s cannot parse UID '%s'"), + virReportSystemError(EINVAL, _("%1$s cannot parse UID '%2$s'"), progname, argv[optind]); goto cleanup; } @@ -241,7 +241,7 @@ main(int argc, char **argv) optind++; if (virStrToLong_ull(argv[optind], NULL, 10, &gidval) < 0 || ((gid_t)gidval) != gidval) { - virReportSystemError(EINVAL, _("%s cannot parse GID '%s'"), + virReportSystemError(EINVAL, _("%1$s cannot parse GID '%2$s'"), progname, argv[optind]); goto cleanup; } @@ -285,7 +285,7 @@ main(int argc, char **argv) last_error = virGetLastError(); if (last_error->code != VIR_ERR_OPERATION_INVALID) { virReportSystemError(last_error->code, - _("Can't create %s container: %s"), + _("Can't create %1$s container: %2$s"), name, last_error->message); goto cleanup; } @@ -318,7 +318,7 @@ main(int argc, char **argv) if (virSetUIDGID(uid, gid, groups, ngroups) < 0) goto cleanup; if (chdir(homedir) < 0) { - virReportSystemError(errno, _("Unable to chdir(%s)"), homedir); + virReportSystemError(errno, _("Unable to chdir(%1$s)"), homedir); goto cleanup; } @@ -347,7 +347,7 @@ main(int argc, char **argv) shcmd = shargv[0]; if (!g_path_is_absolute(shcmd)) { virReportSystemError(errno, - _("Shell '%s' should have absolute path"), + _("Shell '%1$s' should have absolute path"), shcmd); goto cleanup; } @@ -382,7 +382,7 @@ main(int argc, char **argv) g_setenv("TERM", term, TRUE); if (execv(shcmd, (char *const*) shargv) < 0) { - virReportSystemError(errno, _("Unable to exec shell %s"), + virReportSystemError(errno, _("Unable to exec shell %1$s"), shcmd); virDispatchError(NULL); return errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE; diff --git a/tools/virt-pki-query-dn.c b/tools/virt-pki-query-dn.c index 2d7849feb7..c8196e32e3 100644 --- a/tools/virt-pki-query-dn.c +++ b/tools/virt-pki-query-dn.c @@ -28,8 +28,8 @@ print_usage(const char *progname, { fprintf(out, _("Usage:\n" - " %s FILE\n" - " %s { -v | -h }\n" + " %1$s FILE\n" + " %2$s { -v | -h }\n" "\n" "Extract Distinguished Name from a PEM certificate.\n" "The output is meant to be used in the tls_allowed_dn_list\n" @@ -102,7 +102,7 @@ main(int argc, } if (bufsize > UINT_MAX) { - g_printerr(_("%s: File '%s' is too large\n"), progname, filename); + g_printerr(_("%1$s: File '%2$s' is too large\n"), progname, filename); return EXIT_FAILURE; } @@ -111,14 +111,14 @@ main(int argc, rv = gnutls_x509_crt_init(&crt); if (rv < 0) { - g_printerr(_("Unable to initialize certificate: %s\n"), + g_printerr(_("Unable to initialize certificate: %1$s\n"), gnutls_strerror(rv)); return EXIT_FAILURE; } rv = gnutls_x509_crt_import(crt, &crt_data, GNUTLS_X509_FMT_PEM); if (rv < 0) { - g_printerr(_("Unable to load certificate, make sure it is in PEM format: %s\n"), + g_printerr(_("Unable to load certificate, make sure it is in PEM format: %1$s\n"), gnutls_strerror(rv)); return EXIT_FAILURE; } @@ -129,7 +129,7 @@ main(int argc, rv = gnutls_x509_crt_get_dn(crt, dname, &dnamesize); } if (rv != 0) { - g_printerr(_("Failed to get distinguished name: %s\n"), + g_printerr(_("Failed to get distinguished name: %1$s\n"), gnutls_strerror(rv)); return EXIT_FAILURE; } diff --git a/tools/vsh.c b/tools/vsh.c index 0066504ebe..5b672b8edf 100644 --- a/tools/vsh.c +++ b/tools/vsh.c @@ -272,39 +272,39 @@ vshCmddefCheckInternals(vshControl *ctl, const vshCmdDef *alias; if (!cmd->alias) { - vshError(ctl, _("command '%s' has inconsistent alias"), cmd->name); + vshError(ctl, _("command '%1$s' has inconsistent alias"), cmd->name); return -1; } if (!(alias = vshCmddefSearch(cmd->alias))) { - vshError(ctl, _("command alias '%s' is pointing to a non-existent command '%s'"), + vshError(ctl, _("command alias '%1$s' is pointing to a non-existent command '%2$s'"), cmd->name, cmd->alias); return -1; } if (alias->flags & VSH_CMD_FLAG_ALIAS) { - vshError(ctl, _("command alias '%s' is pointing to another command alias '%s'"), + vshError(ctl, _("command alias '%1$s' is pointing to another command alias '%2$s'"), cmd->name, cmd->alias); return -1; } if (cmd->handler) { - vshError(ctl, _("command '%s' has handler set"), cmd->name); + vshError(ctl, _("command '%1$s' has handler set"), cmd->name); return -1; } if (cmd->opts) { - vshError(ctl, _("command '%s' has options set"), cmd->name); + vshError(ctl, _("command '%1$s' has options set"), cmd->name); return -1; } if (cmd->info) { - vshError(ctl, _("command '%s' has info set"), cmd->name); + vshError(ctl, _("command '%1$s' has info set"), cmd->name); return -1; } if (cmd->flags & ~VSH_CMD_FLAG_ALIAS) { - vshError(ctl, _("command '%s' has multiple flags set"), cmd->name); + vshError(ctl, _("command '%1$s' has multiple flags set"), cmd->name); return -1; } @@ -314,7 +314,7 @@ vshCmddefCheckInternals(vshControl *ctl, /* Each command has to provide a non-empty help string. */ if (!(help = vshCmddefGetInfo(cmd, "help")) || !*help) { - vshError(ctl, _("command '%s' lacks help"), cmd->name); + vshError(ctl, _("command '%1$s' lacks help"), cmd->name); return -1; } @@ -325,7 +325,7 @@ vshCmddefCheckInternals(vshControl *ctl, const vshCmdOptDef *opt = &cmd->opts[i]; if (i > 63) { - vshError(ctl, _("command '%s' has too many options"), cmd->name); + vshError(ctl, _("command '%1$s' has too many options"), cmd->name); return -1; /* too many options */ } @@ -337,7 +337,7 @@ vshCmddefCheckInternals(vshControl *ctl, switch (opt->type) { case VSH_OT_BOOL: if (opt->completer || opt->completer_flags) { - vshError(ctl, _("bool parameter '%s' of command '%s' has completer set"), + vshError(ctl, _("bool parameter '%1$s' of command '%2$s' has completer set"), opt->name, cmd->name); return -1; } @@ -346,7 +346,7 @@ vshCmddefCheckInternals(vshControl *ctl, case VSH_OT_STRING: if (opt->flags & VSH_OFLAG_REQ) { - vshError(ctl, _("parameter '%s' of command '%s' misused VSH_OFLAG_REQ"), + vshError(ctl, _("parameter '%1$s' of command '%2$s' misused VSH_OFLAG_REQ"), opt->name, cmd->name); return -1; /* neither bool nor string options can be mandatory */ } @@ -360,7 +360,7 @@ vshCmddefCheckInternals(vshControl *ctl, char *p; if (opt->flags || !opt->help) { - vshError(ctl, _("parameter '%s' of command '%s' has incorrect alias option"), + vshError(ctl, _("parameter '%1$s' of command '%2$s' has incorrect alias option"), opt->name, cmd->name); return -1; /* alias options are tracked by the original name */ } @@ -376,13 +376,13 @@ vshCmddefCheckInternals(vshControl *ctl, if (p) { /* If alias comes with value, replacement must not be bool */ if (cmd->opts[j].type == VSH_OT_BOOL) { - vshError(ctl, _("alias '%s' of command '%s' has mismatched alias type"), + vshError(ctl, _("alias '%1$s' of command '%2$s' has mismatched alias type"), opt->name, cmd->name); return -1; } } if (!cmd->opts[j].name) { - vshError(ctl, _("alias '%s' of command '%s' has missing alias option"), + vshError(ctl, _("alias '%1$s' of command '%2$s' has missing alias option"), opt->name, cmd->name); return -1; /* alias option must map to a later option name */ } @@ -390,7 +390,7 @@ vshCmddefCheckInternals(vshControl *ctl, break; case VSH_OT_ARGV: if (cmd->opts[i + 1].name) { - vshError(ctl, _("parameter '%s' of command '%s' must be listed last"), + vshError(ctl, _("parameter '%1$s' of command '%2$s' must be listed last"), opt->name, cmd->name); return -1; /* argv option must be listed last */ } @@ -398,13 +398,13 @@ vshCmddefCheckInternals(vshControl *ctl, case VSH_OT_DATA: if (!(opt->flags & VSH_OFLAG_REQ)) { - vshError(ctl, _("parameter '%s' of command '%s' must use VSH_OFLAG_REQ flag"), + vshError(ctl, _("parameter '%1$s' of command '%2$s' must use VSH_OFLAG_REQ flag"), opt->name, cmd->name); return -1; /* OT_DATA should always be required. */ } if (seenOptionalOption) { - vshError(ctl, _("parameter '%s' of command '%s' must be listed before optional parameters"), + vshError(ctl, _("parameter '%1$s' of command '%2$s' must be listed before optional parameters"), opt->name, cmd->name); return -1; /* mandatory options must be listed first */ } @@ -413,7 +413,7 @@ vshCmddefCheckInternals(vshControl *ctl, case VSH_OT_INT: if (opt->flags & VSH_OFLAG_REQ) { if (seenOptionalOption) { - vshError(ctl, _("parameter '%s' of command '%s' must be listed before optional parameters"), + vshError(ctl, _("parameter '%1$s' of command '%2$s' must be listed before optional parameters"), opt->name, cmd->name); return -1; /* mandatory options must be listed first */ } @@ -499,7 +499,7 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name, *value = '\0'; if (*optstr) { if (report) - vshError(ctl, _("invalid '=' after option --%s"), + vshError(ctl, _("invalid '=' after option --%1$s"), opt->name); return NULL; } @@ -509,7 +509,7 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name, } if ((*opts_seen & (1ULL << i)) && opt->type != VSH_OT_ARGV) { if (report) - vshError(ctl, _("option --%s already seen"), name); + vshError(ctl, _("option --%1$s already seen"), name); return NULL; } *opts_seen |= 1ULL << i; @@ -519,7 +519,7 @@ vshCmddefGetOption(vshControl *ctl, const vshCmdDef *cmd, const char *name, } if (STRNEQ(cmd->name, "help") && report) { - vshError(ctl, _("command '%s' doesn't support option --%s"), + vshError(ctl, _("command '%1$s' doesn't support option --%2$s"), cmd->name, name); } return NULL; @@ -564,8 +564,8 @@ vshCommandCheckOpts(vshControl *ctl, const vshCmd *cmd, uint64_t opts_required, vshError(ctl, opt->type == VSH_OT_DATA || opt->type == VSH_OT_ARGV ? - _("command '%s' requires <%s> option") : - _("command '%s' requires --%s option"), + _("command '%1$s' requires <%2$s> option") : + _("command '%1$s' requires --%2$s option"), def->name, opt->name); } } @@ -628,7 +628,7 @@ vshCmdGrpHelp(vshControl *ctl, const vshCmdGrp *grp) { const vshCmdDef *cmd = NULL; - vshPrint(ctl, _(" %s (help keyword '%s'):\n"), grp->name, + vshPrint(ctl, _(" %1$s (help keyword '%2$s'):\n"), grp->name, grp->keyword); for (cmd = grp->commands; cmd->name; cmd++) { @@ -666,13 +666,13 @@ vshCmddefHelp(const vshCmdDef *def) case VSH_OT_INT: /* xgettext:c-format */ fmt = ((opt->flags & VSH_OFLAG_REQ) ? "<%s>" - : _("[--%s <number>]")); + : _("[--%1$s <number>]")); if (!(opt->flags & VSH_OFLAG_REQ_OPT)) shortopt = true; break; case VSH_OT_STRING: /* xgettext:c-format */ - fmt = _("[--%s <string>]"); + fmt = _("[--%1$s <string>]"); if (!(opt->flags & VSH_OFLAG_REQ_OPT)) shortopt = true; break; @@ -685,11 +685,11 @@ vshCmddefHelp(const vshCmdDef *def) /* xgettext:c-format */ if (shortopt) { fmt = (opt->flags & VSH_OFLAG_REQ) - ? _("{[--%s] <string>}...") - : _("[[--%s] <string>]..."); + ? _("{[--%1$s] <string>}...") + : _("[[--%1$s] <string>]..."); } else { - fmt = (opt->flags & VSH_OFLAG_REQ) ? _("<%s>...") - : _("[<%s>]..."); + fmt = (opt->flags & VSH_OFLAG_REQ) ? _("<%1$s>...") + : _("[<%1$s>]..."); } break; case VSH_OT_ALIAS: @@ -719,19 +719,19 @@ vshCmddefHelp(const vshCmdDef *def) break; case VSH_OT_INT: g_snprintf(buf, sizeof(buf), - (opt->flags & VSH_OFLAG_REQ) ? _("[--%s] <number>") - : _("--%s <number>"), opt->name); + (opt->flags & VSH_OFLAG_REQ) ? _("[--%1$s] <number>") + : _("--%1$s <number>"), opt->name); break; case VSH_OT_STRING: - g_snprintf(buf, sizeof(buf), _("--%s <string>"), opt->name); + g_snprintf(buf, sizeof(buf), _("--%1$s <string>"), opt->name); break; case VSH_OT_DATA: - g_snprintf(buf, sizeof(buf), _("[--%s] <string>"), + g_snprintf(buf, sizeof(buf), _("[--%1$s] <string>"), opt->name); break; case VSH_OT_ARGV: g_snprintf(buf, sizeof(buf), - shortopt ? _("[--%s] <string>") : _("<%s>"), + shortopt ? _("[--%1$s] <string>") : _("<%1$s>"), opt->name); break; case VSH_OT_ALIAS: @@ -858,7 +858,7 @@ vshCommandOptInt(vshControl *ctl, const vshCmd *cmd, if ((ret = virStrToLong_i(arg->data, NULL, 10, value)) < 0) vshError(ctl, - _("Numeric value '%s' for <%s> option is malformed or out of range"), + _("Numeric value '%1$s' for <%2$s> option is malformed or out of range"), arg->data, name); else ret = 1; @@ -885,7 +885,7 @@ vshCommandOptUIntInternal(vshControl *ctl, ret = virStrToLong_uip(arg->data, NULL, 10, value); if (ret < 0) vshError(ctl, - _("Numeric value '%s' for <%s> option is malformed or out of range"), + _("Numeric value '%1$s' for <%2$s> option is malformed or out of range"), arg->data, name); else ret = 1; @@ -946,7 +946,7 @@ vshCommandOptULInternal(vshControl *ctl, ret = virStrToLong_ulp(arg->data, NULL, 10, value); if (ret < 0) vshError(ctl, - _("Numeric value '%s' for <%s> option is malformed or out of range"), + _("Numeric value '%1$s' for <%2$s> option is malformed or out of range"), arg->data, name); else ret = 1; @@ -1055,7 +1055,7 @@ vshCommandOptStringReq(vshControl *ctl, if (error) { if (!cmd->skipChecks) - vshError(ctl, _("Failed to get option '%s': %s"), name, _(error)); + vshError(ctl, _("Failed to get option '%1$s': %2$s"), name, _(error)); return -1; } @@ -1085,7 +1085,7 @@ vshCommandOptLongLong(vshControl *ctl, const vshCmd *cmd, if ((ret = virStrToLong_ll(arg->data, NULL, 10, value)) < 0) vshError(ctl, - _("Numeric value '%s' for <%s> option is malformed or out of range"), + _("Numeric value '%1$s' for <%2$s> option is malformed or out of range"), arg->data, name); else ret = 1; @@ -1112,7 +1112,7 @@ vshCommandOptULongLongInternal(vshControl *ctl, ret = virStrToLong_ullp(arg->data, NULL, 10, value); if (ret < 0) vshError(ctl, - _("Numeric value '%s' for <%s> option is malformed or out of range"), + _("Numeric value '%1$s' for <%2$s> option is malformed or out of range"), arg->data, name); else ret = 1; @@ -1181,8 +1181,8 @@ vshCommandOptScaledInt(vshControl *ctl, const vshCmd *cmd, if (virStrToLong_ullp(arg->data, &end, 10, value) < 0 || virScaleInteger(value, end, scale, max) < 0) { vshError(ctl, - _("Scaled numeric value '%s' for <%s> option is malformed or " - "out of range"), arg->data, name); + _("Scaled numeric value '%1$s' for <%2$s> option is malformed or out of range"), + arg->data, name); return -1; } @@ -1272,8 +1272,8 @@ vshBlockJobOptionBandwidth(vshControl *ctl, if (virStrToLong_ullp(arg->data, &end, 10, &bw) < 0 || virScaleInteger(&bw, end, 1, ULONG_MAX) < 0) { vshError(ctl, - _("Scaled numeric value '%s' for <--bandwidth> option is " - "malformed or out of range"), arg->data); + _("Scaled numeric value '%1$s' for <--bandwidth> option is malformed or out of range"), + arg->data); return -1; } @@ -1332,7 +1332,7 @@ vshCommandRun(vshControl *ctl, const vshCmd *cmd) if (enable_timing) { double diff_ms = (after - before) / 1000.0; - vshPrint(ctl, _("\n(Time: %.3f ms)\n\n"), diff_ms); + vshPrint(ctl, _("\n(Time: %1$.3f ms)\n\n"), diff_ms); } else { vshPrintExtra(ctl, "\n"); } @@ -1417,7 +1417,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser, vshCmd **partial) break; } else if (!(cmd = vshCmddefSearch(tkdata))) { if (!partial) - vshError(ctl, _("unknown command: '%s'"), tkdata); + vshError(ctl, _("unknown command: '%1$s'"), tkdata); goto syntaxError; /* ... or ignore this command only? */ } @@ -1477,7 +1477,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser, vshCmd **partial) last = arg; } else { vshError(ctl, - _("expected syntax: --%s <%s>"), + _("expected syntax: --%1$s <%2$s>"), opt->name, opt->type == VSH_OT_INT ? _("number") : _("string")); @@ -1490,7 +1490,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser, vshCmd **partial) tkdata = NULL; if (optstr) { if (!partial) - vshError(ctl, _("invalid '=' after option --%s"), + vshError(ctl, _("invalid '=' after option --%1$s"), opt->name); VIR_FREE(optstr); goto syntaxError; @@ -1508,7 +1508,7 @@ vshCommandParse(vshControl *ctl, vshCommandParser *parser, vshCmd **partial) &opts_seen)) && STRNEQ(cmd->name, "help")) { if (!partial) - vshError(ctl, _("unexpected data '%s'"), tkdata); + vshError(ctl, _("unexpected data '%1$s'"), tkdata); goto syntaxError; } } @@ -1784,7 +1784,7 @@ vshCommandOptTimeoutToMs(vshControl *ctl, const vshCmd *cmd, int *timeout) * it from seconds to milliseconds without overflowing. */ if (utimeout == 0 || utimeout > INT_MAX / 1000) { vshError(ctl, - _("Numeric value '%u' for <%s> option is malformed or out of range"), + _("Numeric value '%1$u' for <%2$s> option is malformed or out of range"), utimeout, "timeout"); ret = -1; @@ -1836,7 +1836,7 @@ vshGetTypedParamValue(vshControl *ctl, virTypedParameterPtr item) break; default: - vshError(ctl, _("unimplemented parameter type %d"), item->type); + vshError(ctl, _("unimplemented parameter type %1$d"), item->type); exit(EXIT_FAILURE); } } @@ -1977,7 +1977,7 @@ vshTTYMakeRaw(vshControl *ctl G_GNUC_UNUSED, if (tcsetattr(STDIN_FILENO, TCSAFLUSH, &rawattr) < 0) { if (report_errors) - vshError(ctl, _("unable to set tty attributes: %s"), + vshError(ctl, _("unable to set tty attributes: %1$s"), g_strerror(errno)); return -1; } @@ -2153,7 +2153,7 @@ vshEventWait(vshControl *ctl) if (rv != 1) { if (!rv) errno = EPIPE; - vshError(ctl, _("failed to determine loop exit status: %s"), + vshError(ctl, _("failed to determine loop exit status: %1$s"), g_strerror(errno)); return -1; } @@ -2284,7 +2284,7 @@ vshCloseLogFile(vshControl *ctl) { /* log file close */ if (VIR_CLOSE(ctl->log_fd) < 0) { - vshError(ctl, _("%s: failed to write log file: %s"), + vshError(ctl, _("%1$s: failed to write log file: %2$s"), ctl->logfile ? ctl->logfile : "?", g_strerror(errno)); } @@ -2406,7 +2406,7 @@ vshEditWriteToTempFile(vshControl *ctl, const char *doc) filename = g_strdup_printf("%s/virshXXXXXX.xml", tmpdir); fd = g_mkstemp_full(filename, O_RDWR | O_CLOEXEC, S_IRUSR | S_IWUSR); if (fd == -1) { - vshError(ctl, _("g_mkstemp_full: failed to create temporary file: %s"), + vshError(ctl, _("g_mkstemp_full: failed to create temporary file: %1$s"), g_strerror(errno)); return NULL; } @@ -2414,12 +2414,12 @@ vshEditWriteToTempFile(vshControl *ctl, const char *doc) ret = g_steal_pointer(&filename); if (safewrite(fd, doc, strlen(doc)) == -1) { - vshError(ctl, _("write: %s: failed to write to temporary file: %s"), + vshError(ctl, _("write: %1$s: failed to write to temporary file: %2$s"), ret, g_strerror(errno)); return NULL; } if (VIR_CLOSE(fd) < 0) { - vshError(ctl, _("close: %s: failed to write or close temporary file: %s"), + vshError(ctl, _("close: %1$s: failed to write or close temporary file: %2$s"), ret, g_strerror(errno)); return NULL; } @@ -2461,8 +2461,7 @@ vshEditFile(vshControl *ctl, const char *filename) if (strspn(editor, ACCEPTED_CHARS) != strlen(editor)) { if (strspn(filename, ACCEPTED_CHARS) != strlen(filename)) { vshError(ctl, - _("%s: temporary filename contains shell meta or other " - "unacceptable characters (is $TMPDIR wrong?)"), + _("%1$s: temporary filename contains shell meta or other unacceptable characters (is $TMPDIR wrong?)"), filename); return -1; } @@ -2490,7 +2489,7 @@ vshEditReadBackFile(vshControl *ctl, const char *filename) if (virFileReadAll(filename, VSH_MAX_XML_FILE, &ret) == -1) { vshError(ctl, - _("%s: failed to read temporary file: %s"), + _("%1$s: failed to read temporary file: %2$s"), filename, g_strerror(errno)); return NULL; } @@ -2863,11 +2862,10 @@ vshReadlineInit(vshControl *ctl) /* Limit the total size of the history buffer */ if ((histsize_str = getenv(histsize_env))) { if (virStrToLong_i(histsize_str, NULL, 10, &max_history) < 0) { - vshError(ctl, _("Bad $%s value."), histsize_env); + vshError(ctl, _("Bad $%1$s value."), histsize_env); return -1; } else if (max_history > HISTSIZE_MAX || max_history < 0) { - vshError(ctl, _("$%s value should be between 0 " - "and %d"), + vshError(ctl, _("$%1$s value should be between 0 and %2$d"), histsize_env, HISTSIZE_MAX); return -1; } @@ -2893,7 +2891,7 @@ vshReadlineDeinit(vshControl *ctl) if (ctl->historyfile != NULL) { if (g_mkdir_with_parents(ctl->historydir, 0755) < 0 && errno != EEXIST) { - vshError(ctl, _("Failed to create '%s': %s"), + vshError(ctl, _("Failed to create '%1$s': %2$s"), ctl->historydir, g_strerror(errno)); } else { write_history(ctl->historyfile); @@ -2977,7 +2975,7 @@ vshInitDebug(vshControl *ctl) int debug; if (virStrToLong_i(debugEnv, NULL, 10, &debug) < 0 || debug < VSH_ERR_DEBUG || debug > VSH_ERR_ERROR) { - vshError(ctl, _("%s_DEBUG not set with a valid numeric value"), + vshError(ctl, _("%1$s_DEBUG not set with a valid numeric value"), ctl->env_prefix); } else { ctl->debug = debug; @@ -3101,7 +3099,7 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd) vshPrint(ctl, "%s", _("Grouped commands:\n\n")); for (grp = cmdGroups; grp->name; grp++) { - vshPrint(ctl, _(" %s (help keyword '%s'):\n"), grp->name, + vshPrint(ctl, _(" %1$s (help keyword '%2$s'):\n"), grp->name, grp->keyword); for (def = grp->commands; def->name; def++) { @@ -3125,7 +3123,7 @@ cmdHelp(vshControl *ctl, const vshCmd *cmd) } else if ((grp = vshCmdGrpSearch(name))) { return vshCmdGrpHelp(ctl, grp); } else { - vshError(ctl, _("command or command group '%s' doesn't exist"), name); + vshError(ctl, _("command or command group '%1$s' doesn't exist"), name); return false; } } @@ -3165,7 +3163,7 @@ cmdCd(vshControl *ctl, const vshCmd *cmd) dir = "/"; if (chdir(dir) == -1) { - vshError(ctl, _("cd: %s: %s"), + vshError(ctl, _("cd: %1$s: %2$s"), g_strerror(errno), dir); return false; } @@ -3282,7 +3280,7 @@ cmdPwd(vshControl *ctl, const vshCmd *cmd G_GNUC_UNUSED) { g_autofree char *cwd = g_get_current_dir(); - vshPrint(ctl, _("%s\n"), cwd); + vshPrint(ctl, _("%1$s\n"), cwd); return true; } diff --git a/tools/vsh.h b/tools/vsh.h index 657a1e7a93..51f09cd2b0 100644 --- a/tools/vsh.h +++ b/tools/vsh.h @@ -486,7 +486,7 @@ void vshReadlineHistoryAdd(const char *cmd); */ #define VSH_EXCLUSIVE_OPTIONS_EXPR(NAME1, EXPR1, NAME2, EXPR2) \ if ((EXPR1) && (EXPR2)) { \ - vshError(ctl, _("Options --%s and --%s are mutually exclusive"), \ + vshError(ctl, _("Options --%1$s and --%2$s are mutually exclusive"), \ NAME1, NAME2); \ return false; \ } @@ -541,7 +541,7 @@ void vshReadlineHistoryAdd(const char *cmd); bool _expr2 = EXPR2; \ VSH_EXCLUSIVE_OPTIONS_EXPR(NAME1, _expr1, NAME2, _expr2); \ if (!_expr1 && !_expr2) { \ - vshError(ctl, _("Either --%s or --%s must be provided"), \ + vshError(ctl, _("Either --%1$s or --%2$s must be provided"), \ NAME1, NAME2); \ return false; \ } \ @@ -565,7 +565,7 @@ void vshReadlineHistoryAdd(const char *cmd); #define VSH_REQUIRE_OPTION_EXPR(NAME1, EXPR1, NAME2, EXPR2) \ do { \ if ((EXPR1) && !(EXPR2)) { \ - vshError(ctl, _("Option --%s is required by option --%s"), \ + vshError(ctl, _("Option --%1$s is required by option --%2$s"), \ NAME2, NAME1); \ return false; \ } \ -- 2.39.2