Fix to gpilot-install-file.
- From: Alan Shutko <ats acm org>
- To: gnome-pilot-list gnome org
- Subject: Fix to gpilot-install-file.
- Date: 25 Oct 1999 16:02:39 -0400
I noticed that gpilot-install-file kept complaining about things like
file "--now" not found. popt doesn't remove options from argv, so
iterating over argv hit the options as well. Here's a fix I picked up
from Havoc's book.
--
Alan Shutko <ats@acm.org> - In a variety of flavors!
Oxymoron: True DOS multi-tasking
cvs server: Diffing conduits/file
Index: conduits/file/ChangeLog
===================================================================
RCS file: /cvs/gnome/gnome-pilot/conduits/file/ChangeLog,v
retrieving revision 1.2
diff -c -r1.2 ChangeLog
*** conduits/file/ChangeLog 1999/10/25 03:50:42 1.2
--- conduits/file/ChangeLog 1999/10/25 19:59:53
***************
*** 1,3 ****
--- 1,10 ----
+ 1999-10-22 Alan Shutko <ats@acm.org>
+
+ * gpilot_install_file.c (main): fixed argument handling. popt
+ doesn't remove options it finds, so --now was both being treated
+ as a file and setting the option. Now uses poptGetArgs (as per
+ Havoc's book).
+
1999-10-23 Vadim Strizhvesky <vadim@optonline.net>
* file-conduit-control-applet.c: fixed some messages to pertain to
Index: conduits/file/gpilot_install_file.c
===================================================================
RCS file: /cvs/gnome/gnome-pilot/conduits/file/gpilot_install_file.c,v
retrieving revision 1.5
diff -c -r1.5 gpilot_install_file.c
*** conduits/file/gpilot_install_file.c 1999/10/22 00:23:07 1.5
--- conduits/file/gpilot_install_file.c 1999/10/25 19:59:53
***************
*** 77,92 ****
{
int err,i;
GNOME_Pilot_Survival survive;
gchar **pilots = NULL;
!
if(argc<2) {
g_message("usage : %s [--now|--later] [FILE]",argv[0]);
exit(1);
}
! gnome_CORBA_init_with_popt_table("gpilotd-install","1.0",
&argc,argv,
! options,0,NULL,
0,&ev);
/* 1. initialize the gpilotd connection */
--- 77,94 ----
{
int err,i;
GNOME_Pilot_Survival survive;
+ poptContext pctx;
gchar **pilots = NULL;
! char **args;
!
if(argc<2) {
g_message("usage : %s [--now|--later] [FILE]",argv[0]);
exit(1);
}
! gnome_CORBA_init_with_popt_table("gpilotd-install-file","1.0",
&argc,argv,
! options,0,&pctx,
0,&ev);
/* 1. initialize the gpilotd connection */
***************
*** 114,134 ****
survive = GNOME_Pilot_IMMEDIATE;
if (later) survive = GNOME_Pilot_PERSISTENT;
! i=1;
! while(argv[i]!=NULL) {
! if (g_file_exists(argv[i]) != 0) {
! handle = gpilotd_install_file(pilots[0],argv[i],survive,0);
if (handle > 0) {
handles = g_slist_prepend(handles,(gpointer)handle);
! notfailed = g_slist_prepend(notfailed,argv[i]);
} else {
! failed = g_slist_prepend(failed,argv[i]);
}
} else {
! failed = g_slist_prepend(failed,g_strdup(argv[i]));
}
i++;
}
if (!later) {
gchar *message;
--- 116,141 ----
survive = GNOME_Pilot_IMMEDIATE;
if (later) survive = GNOME_Pilot_PERSISTENT;
! i=0;
!
! args = poptGetArgs(pctx);
!
! while(args && args[i]!=NULL) {
! if (g_file_exists(args[i]) != 0) {
! handle = gpilotd_install_file(pilots[0],args[i],survive,0);
if (handle > 0) {
handles = g_slist_prepend(handles,(gpointer)handle);
! notfailed = g_slist_prepend(notfailed,args[i]);
} else {
! failed = g_slist_prepend(failed,args[i]);
}
} else {
! failed = g_slist_prepend(failed,g_strdup(args[i]));
}
i++;
}
+
+ poptFreeContext(pctx);
if (!later) {
gchar *message;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]