summaryrefslogtreecommitdiff
path: root/cliutils.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2010-08-20 15:17:08 +0300
committerPanu Matilainen <pmatilai@redhat.com>2010-08-20 15:23:48 +0300
commitfbd92df7544462a88cd8c752ffe07263dc8bb858 (patch)
treee6e2f009714b930ca8cd7371a9aa62fbc9334834 /cliutils.c
parente951c42146d89a5f4abdb02eaf9e44eead235e2f (diff)
downloadrpm-fbd92df7544462a88cd8c752ffe07263dc8bb858.tar.gz
rpm-fbd92df7544462a88cd8c752ffe07263dc8bb858.tar.bz2
rpm-fbd92df7544462a88cd8c752ffe07263dc8bb858.zip
Argh. Realize we already have equivalents of initCli() and finishCli()
- rpmcliInit() and rpmcliFini() do almost exactly the same as our newborn cli-helpers, but they've been almost unused until now. Use them and lose the new ones.. doh. - The downside is that popt aliases are now broken when running commands from the build tree due to lt-foo in argv[0], whereas initCli() took and explicit popt context name argument. Oh well... - rpmcliFini() was missing several necessary memory cleanup calls, add them there while at it.
Diffstat (limited to 'cliutils.c')
-rw-r--r--cliutils.c71
1 files changed, 0 insertions, 71 deletions
diff --git a/cliutils.c b/cliutils.c
index 23c632372..cbbc7fef2 100644
--- a/cliutils.c
+++ b/cliutils.c
@@ -44,77 +44,6 @@ void printUsage(poptContext con, FILE * fp, int flags)
poptPrintUsage(con, fp, flags);
}
-poptContext initCli(const char *ctx, struct poptOption *optionsTable,
- int argc, char *argv[])
-{
- const char *optArg;
- int arg;
- poptContext optCon;
-
-#if HAVE_MCHECK_H && HAVE_MTRACE
- mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
-#endif
-
-#if defined(ENABLE_NLS)
- /* set up the correct locale */
- (void) setlocale(LC_ALL, "" );
-
- bindtextdomain(PACKAGE, LOCALEDIR);
- textdomain(PACKAGE);
-#endif
-
- rpmSetVerbosity(RPMLOG_NOTICE); /* XXX silly use by showrc */
-
- /* Make a first pass through the arguments, looking for --rcfile */
- /* We need to handle that before dealing with the rest of the arguments. */
- /* XXX popt argv definition should be fixed instead of casting... */
- optCon = poptGetContext(ctx, argc, (const char **)argv, optionsTable, 0);
- {
- char *poptfile = rpmGenPath(rpmConfigDir(), LIBRPMALIAS_FILENAME, NULL);
- (void) poptReadConfigFile(optCon, poptfile);
- free(poptfile);
- }
- (void) poptReadDefaultConfig(optCon, 1);
- poptSetExecPath(optCon, rpmConfigDir(), 1);
-
- while ((arg = poptGetNextOpt(optCon)) > 0) {
- optArg = poptGetOptArg(optCon);
-
- switch (arg) {
- default:
- fprintf(stderr, _("Internal error in argument processing (%d) :-(\n"), arg);
- exit(EXIT_FAILURE);
- }
- }
-
- if (arg < -1) {
- fprintf(stderr, "%s: %s\n",
- poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
- poptStrerror(arg));
- exit(EXIT_FAILURE);
- }
-
- rpmcliConfigured();
-
- return optCon;
-}
-
-int finishCli(poptContext optCon, int rc)
-{
- poptFreeContext(optCon);
- rpmFreeMacros(NULL);
- rpmFreeMacros(rpmCLIMacroContext);
- rpmFreeRpmrc();
- rpmlogClose();
-
-#if HAVE_MCHECK_H && HAVE_MTRACE
- muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
-#endif
-
- /* XXX Avoid exit status overflow. Status 255 is special to xargs(1) */
- return (rc > 254) ? 254 : rc;
-}
-
int initPipe(void)
{
int p[2];