Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 700140 Details for
Bug 622635
alternatives should have --list option
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
potential patch
list.patch (text/plain), 2.58 KB, created by
Lukáš Nykrýn
on 2013-02-20 17:12:44 UTC
(
hide
)
Description:
potential patch
Filename:
MIME Type:
Creator:
Lukáš Nykrýn
Created:
2013-02-20 17:12:44 UTC
Size:
2.58 KB
patch
obsolete
>diff --git a/alternatives.c b/alternatives.c >index 4d87627..8a55e09 100644 >--- a/alternatives.c >+++ b/alternatives.c >@@ -21,8 +21,10 @@ > #include <stdlib.h> > #include <stdio.h> > #include <string.h> >+#include <dirent.h> > #include <sys/stat.h> > #include <sys/unistd.h> >+#include <sys/types.h> > #include <unistd.h> > > #define FLAGS_TEST (1 << 0) >@@ -57,7 +59,7 @@ struct alternativeSet { > > enum programModes { MODE_UNKNOWN, MODE_INSTALL, MODE_REMOVE, MODE_AUTO, > MODE_DISPLAY, MODE_CONFIG, MODE_SET, >- MODE_SLAVE, MODE_VERSION, MODE_USAGE }; >+ MODE_SLAVE, MODE_VERSION, MODE_USAGE, MODE_LIST }; > > static int usage(int rc) { > printf(_("alternatives version %s - Copyright (C) 2001 Red Hat, Inc.\n"), VERSION); >@@ -70,6 +72,7 @@ static int usage(int rc) { > printf(_(" alternatives --config <name>\n")); > printf(_(" alternatives --display <name>\n")); > printf(_(" alternatives --set <name> <path>\n")); >+ printf(_(" alternatives --list\n")); > printf(_("\n")); > printf(_("common options: --verbose --test --help --usage --version\n")); > printf(_(" --altdir <directory> --admindir <directory>\n")); >@@ -849,6 +852,31 @@ static int removeService(const char * title, const char * target, > return 0; > } > >+static int listServices(const char * altDir, const char * stateDir, int flags) { >+ DIR *dir; >+ struct dirent *ent; >+ dir = opendir(stateDir); >+ struct alternativeSet set; >+ >+ if(dir == NULL) >+ return 2; >+ >+ while((ent = readdir(dir)) != NULL) { >+ if(!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, "..")) >+ continue; >+ >+ if (readConfig(&set, ent->d_name, altDir, stateDir, flags)) >+ return 2; >+ >+ printf("%s\t%s\t%s\n", ent->d_name, set.mode == AUTO?"auto":"manual", set.currentLink); >+ } >+ >+ closedir(dir); >+ >+ return 0; >+} >+ >+ > int main(int argc, const char ** argv) { > const char ** nextArg; > char * end; >@@ -931,6 +959,10 @@ int main(int argc, const char ** argv) { > if (!*nextArg) usage(2); > stateDir = strdup(*nextArg); > nextArg++; >+ } else if (!strcmp(*nextArg, "--list")) { >+ if (mode != MODE_UNKNOWN) usage(2); >+ mode = MODE_LIST; >+ nextArg++; > } else { > usage(2); > } >@@ -970,6 +1002,8 @@ int main(int argc, const char ** argv) { > return removeService(title, target, altDir, stateDir, flags); > case MODE_SLAVE: > usage(2); >+ case MODE_LIST: >+ return listServices(altDir, stateDir, flags); > } > > abort();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 622635
: 700140