Re: fdesign -convert is buggy

2004-05-28 Thread Angus Leeming
Angus Leeming wrote: >> String manipulation in C is so nice ;-) > > Isn't it just. Thanks for this, Georg. Actually, once you've got your head around the fact that nobody is there to hold your hand, it isn't too bad. The attached trial program has been tested and is always safe. I'm going to comm

Re: fdesign -convert is buggy

2004-05-28 Thread Angus Leeming
Georg Baum wrote: >> Test code attached. I'm pretty sure that this is safe, but would >> value second opinions... > > IMHO you should use strncat and strncpy instead of strcat and > strcpy. I am not sure if strncat requires it, but strncpy does not > terminate the string correctly if it was too lo

Re: fdesign -convert is buggy

2004-05-28 Thread Georg Baum
Angus Leeming wrote: > I believe that we achieve what you're looking for with > -} else > - strcpy(fname, filename); > +} else { > + size_t const buffer_size = 512; > + char buffer[buffer_size]; > + char * cwd = getcwd(buffer, buffer_size); > + if (cwd) { > +

Re: fdesign -convert is buggy

2004-05-27 Thread Angus Leeming
Lars Gullik Bjønnes wrote: > | } else > | strcpy(fname, filename); > | } > | strcat(fname, ext); > | } > > It almost seems to me that the else clause should just be > >strcpy(fname, filename_only(filename)); I think you're correct. Thanks. > | build_fname(fname, "foo/bar/baz", ".h"); > > I

Re: fdesign -convert is buggy

2004-05-27 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | I believe that we achieve what you're looking for with | -} else | - strcpy(fname, filename); | +} else { | + size_t const buffer_size = 512; | + char buffer[buffer_size]; | + char * cwd = getcwd(buffer, buffer_size); | +

Re: fdesign -convert is buggy

2004-05-27 Thread Angus Leeming
Angus Leeming wrote: > Lars Gullik Bjønnes wrote: >> (and I am not saying that -dir should be removed, I am saying that >> fdesign should output to pwd (unless -dir is specified of course.)) > > Ok, understood. You want me to mess around with malloc just before > we try and get XForms 1.1 out of

Re: fdesign -convert is buggy

2004-05-27 Thread Angus Leeming
Lars Gullik Bjønnes wrote: > (and I am not saying that -dir should be removed, I am saying that > fdesign should output to pwd (unless -dir is specified of course.)) Ok, understood. You want me to mess around with malloc just before we try and get XForms 1.1 out of the door. Bad man! I'll have a

Re: fdesign -convert is buggy

2004-05-27 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Jean-Marc Lasgouttes wrote: >> Lars> Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: >> Lars> | This would break compatibility with older versions of >> fdesign. >> >> Lars> Would it really? >> >> Lars> Older versions of fdesign only works with the *.

Re: fdesign -convert is buggy

2004-05-27 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Man page attached, but my conclusion is that uic is just different. | Nonetheless, the sematics that we have now have similar power to | those of uic. Except for the surprising behaviour that fdesign output files to the same dir there the .fd file is lo

Re: fdesign -convert is buggy

2004-05-27 Thread Angus Leeming
Jean-Marc Lasgouttes wrote: >> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes: > > Angus> We would merely be swapping one semantic that works for > another Angus> one which is not yet proven. I don't see what it > gains us. As I Angus> see it I can do: > > Angus> $ cd $HOME $ fd

Re: fdesign -convert is buggy

2004-05-27 Thread Jean-Marc Lasgouttes
> "Angus" == Angus Leeming <[EMAIL PROTECTED]> writes: Angus> We would merely be swapping one semantic that works for another Angus> one which is not yet proven. I don't see what it gains us. As I Angus> see it I can do: Angus> $ cd $HOME $ fdesign -dir destdir -convert foo/bar.fd An

Re: fdesign -convert is buggy

2004-05-27 Thread Angus Leeming
Jean-Marc Lasgouttes wrote: > Lars> Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: > Lars> | This would break compatibility with older versions of > fdesign. > > Lars> Would it really? > > Lars> Older versions of fdesign only works with the *.fd file in the > Lars> same dir as where fdesign is

Re: fdesign -convert is buggy

2004-05-27 Thread Angus Leeming
Lars Gullik Bjønnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > > | @@ -610,8 +600,14 @@ pre_connect(int ac, char *av[]) > | > | for (s = i; s < ac; s++) > | { > | - if (load_forms(FALSE, av[s], 0) >= 0) > | - save_forms(av[s]); > | + if (load_forms(FALSE, av[s]

Re: fdesign -convert is buggy

2004-05-27 Thread Jean-Marc Lasgouttes
> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes: Lars> Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: Lars> | This would break compatibility with older versions of fdesign. Lars> Would it really? Lars> Older versions of fdesign only works with the *.fd file in the Lars> same dir

Re: fdesign -convert is buggy

2004-05-27 Thread Lars Gullik Bjønnes
Jean-Marc Lasgouttes <[EMAIL PROTECTED]> writes: >> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes: > | Lars> | Moreover, running (again from the builddir != src dir): >>> | Lars> | fdesign -dir . -convert | | Lars> /home/angus/lyx/devel/src/frontends/xforms/forms/form_external.fd >

Re: fdesign -convert is buggy

2004-05-27 Thread Jean-Marc Lasgouttes
> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes: Lars> | Moreover, running (again from the builddir != src dir): >> Lars> | fdesign -dir . -convert | Lars> /home/angus/lyx/devel/src/frontends/xforms/forms/form_external.fd Lars> is the -dir . needed? IMHO it shouldn't be. fdesign sh

Re: fdesign -convert is buggy

2004-05-27 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | @@ -610,8 +600,14 @@ pre_connect(int ac, char *av[]) | | for (s = i; s < ac; s++) | { | - if (load_forms(FALSE, av[s], 0) >= 0) | - save_forms(av[s]); | + if (load_forms(FALSE, av[s], 0) < 0) { | + fp

Re: fdesign -convert is buggy

2004-05-27 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Do you have xforms cvs? no (and that is probably good since I now caught the problem myself, and didn't have to debug somebody elses problem) | If my testing doesn't throw up any problems, | I'm going to commit the attached patch. It gives you improved

Re: fdesign -convert is buggy

2004-05-27 Thread Angus Leeming
Lars Gullik Bjnnes wrote: > Angus Leeming <[EMAIL PROTECTED]> writes: > > | Lars Gullik Bjnnes wrote: >>> It seems that fdesign returns 0 even if something went wrong. > > I forgot to say "when using -convert" > > | Wrong list... > > I know... but this is where I have the problem... > > | Bot

Re: fdesign -convert is buggy

2004-05-27 Thread Lars Gullik Bjønnes
Angus Leeming <[EMAIL PROTECTED]> writes: | Lars Gullik Bjønnes wrote: >> It seems that fdesign returns 0 even if something went wrong. I forgot to say "when using -convert" | Wrong list... I know... but this is where I have the problem... | Both load_forms and save_forms return whether they

Re: fdesign -convert is buggy

2004-05-27 Thread Angus Leeming
Lars Gullik Bjønnes wrote: > And the arguemnt to convert _must_ be _just_ a file. Not even ./ is > allowed in front of the filename. I know. Crappy isn't it. -- Angus

Re: fdesign -convert is buggy

2004-05-27 Thread Angus Leeming
Lars Gullik Bjønnes wrote: > It seems that fdesign returns 0 even if something went wrong. > > (writing the files f.ex.) Wrong list... In general, you're wrong. fdesign will exit early and return 1 in lots of places: if (!(fd_display = fl_initialize(&ac, av, 0, fd_cmdopt, Ncopt))) e

Re: fdesign -convert is buggy

2004-05-27 Thread Lars Gullik Bjønnes
[EMAIL PROTECTED] (Lars Gullik Bjønnes) writes: | It seems that fdesign returns 0 even if something went wrong. > | (writing the files f.ex.) And the arguemnt to convert _must_ be _just_ a file. Not even ./ is allowed in front of the filename. -- Lgb

fdesign -convert is buggy

2004-05-27 Thread Lars Gullik Bjønnes
It seems that fdesign returns 0 even if something went wrong. (writing the files f.ex.) -- Lgb