diff options
author | Florent Villard <warly@mandriva.com> | 2005-04-06 14:54:24 +0000 |
---|---|---|
committer | Florent Villard <warly@mandriva.com> | 2005-04-06 14:54:24 +0000 |
commit | fdd5399b67621be80331680829ae7cb390c8c252 (patch) | |
tree | 555c76f3462ec270b8ade71e8113f85cd381291b | |
parent | 5a84376646a5d005cb85197ede3db2aad534b878 (diff) | |
download | bootsplash-fdd5399b67621be80331680829ae7cb390c8c252.tar bootsplash-fdd5399b67621be80331680829ae7cb390c8c252.tar.gz bootsplash-fdd5399b67621be80331680829ae7cb390c8c252.tar.bz2 bootsplash-fdd5399b67621be80331680829ae7cb390c8c252.tar.xz bootsplash-fdd5399b67621be80331680829ae7cb390c8c252.zip |
fbmenu checks for several similar entries
-rw-r--r-- | bootsplash.spec | 5 | ||||
-rw-r--r-- | fb/fbmenu.c | 33 |
2 files changed, 32 insertions, 6 deletions
diff --git a/bootsplash.spec b/bootsplash.spec index 82e7f71..2ed0de2 100644 --- a/bootsplash.spec +++ b/bootsplash.spec @@ -1,5 +1,5 @@ %define name bootsplash -%define version 3.1.6 +%define version 3.1.7 %define release 1mdk %define _bootdir /boot @@ -87,6 +87,9 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/* %changelog +* Wed Apr 06 2005 Warly <warly@mandrakesoft.com> 3.1.7-1mdk +- Now fbmenu check that there are no duplicate entries + * Fri Apr 1 2005 Olivier Blin <oblin@mandrakesoft.com> 3.1.6-1mdk - really try to get resolution from /dev/fb0 - fix BuildRequires diff --git a/fb/fbmenu.c b/fb/fbmenu.c index 2deda5f..850cd11 100644 --- a/fb/fbmenu.c +++ b/fb/fbmenu.c @@ -131,10 +131,27 @@ void return_default(int x) { exit(0); } +int filter_argv (int argc, char **argv, char **nargv) { + int i, j=0, k, done; + for (i = 0; i < argc; i++) { + done = 0; + for (k = 0; k < j; k++) { + if (!strcmp(argv[i], nargv[k])) { + done = 1; + } + } + if (done) continue; + nargv[j++] = argv[i]; + } + return j; +} + int main(int argc, char **argv) { int i; int shift = 2; int title = 2; + int nargc; + char *nargv[argc]; if (argc < 4) { usage(); @@ -144,6 +161,12 @@ int main(int argc, char **argv) { exit(0); } deflt = argv[3]; + nargv[0] = argv[2]; + nargc = filter_argv(argc - shift - 1, argv + shift + 1, nargv + 1); + if (nargc == 1) { + printf("\nRESULT=\"%s\"\n", nargv[0]); + exit(0); + } fb = open("/dev/fb0",O_RDWR); if (-1 == fb && getenv("DISPLAY") == NULL) { @@ -151,16 +174,16 @@ int main(int argc, char **argv) { alarm(atoi(argv[1])); do { fprintf(stderr,"\n"); - for (i = 1; i < argc - shift; i++) { - fprintf(stderr,"%d - %s\n", i, argv[i + shift]); + for (i = 0; i < nargc; i++) { + fprintf(stderr,"%d - %s\n", i + 1, nargv[i]); } fprintf(stderr,"\n%s: ", argv[title]); if (!scanf("%d", &i)) scanf("%*s"); - } while (i < 1 || i >= (argc - shift)); - printf("\nRESULT=\"%s\"\n", argv[i + shift]); + } while (i < 1 || i > nargc); + printf("\nRESULT=\"%s\"\n", nargv[i - 1]); } else { gtk_init (&argc, &argv); - do_button_box(window, argc - shift, argv + shift); + do_button_box(window, nargc + 1, nargv); g_timeout_add(atoi(argv[1]) * 1000, (GSourceFunc) return_default, NULL); gtk_main (); } |