[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[debian-devel:14535] Re: fail to port; ne
In article <20010823165812O.kohda@xxxxxxxxxxxxxxxxxxxx> (at Thu, 23 Aug 2001 16:55:35 +0900), Atsuhito Kohda <kohda@xxxxxxxxxxxxxxxxxxxx> says:
> PowerPC への port で ne が失敗します。
:
> args=*(va_list *)vp;
>
> p=va_arg(args,char *);
> if (p==NULL)
> strcpy(mip->str,"null"); else
> strcpy(mip->str,p);
>
> *(va_list *)vp=args;
ANSI な va_start, va_end でどうでしょう?
Debian では gcc, glibc は(ある程度)仮定できますし...
diff -ru ne/src/ed.h ne-3+00pre16.fix/src/ed.h
--- ne/src/ed.h Wed Jan 5 03:33:36 2000
+++ ne-3+00pre16.fix/src/ed.h Fri Aug 24 21:28:25 2001
@@ -304,7 +304,7 @@
dispreg_t *drp;
} menu_t;
-extern void menu_itemmake(menu_t *mnp,void func(int,mitem_t *,void *),size_t nums,void *vp);
+extern void menu_itemmake(menu_t *mnp,void func(int,mitem_t *,...),size_t nums,void *vp);
extern void menu_itemmakelists(menu_t *mnp,size_t width,size_t num,char *s);
extern void menu_iteminit(menu_t *mnp);
extern void menu_itemfin(menu_t *mnp);
Only in ne-3+00pre16.fix/src: file.o
diff -ru ne/src/filer.c ne-3+00pre16.fix/src/filer.c
--- ne/src/filer.c Mon Nov 15 18:00:00 1999
+++ ne-3+00pre16.fix/src/filer.c Fri Aug 24 21:30:55 2001
@@ -17,7 +17,7 @@
# include <time.h>
# endif
#endif
-
+#include <stdarg.h>
/* ディレクトリ移動遍歴処理 */
@@ -447,14 +447,16 @@
sprintf(s," %4ld",(long)n);
}
-void fw_item_proc(int a,mitem_t *mip,void *vp)
+void fw_item_proc(int a,mitem_t *mip,...)
{
char buf[MAXLINESTR+1];
char *s,*p;
struct tm *tm;
fw_t *fwp;
+ va_list args;
- fwp=vp;
+ va_start(args, mip);
+ fwp=va_arg(args,fw_t *);
s=mip->str;
strjfcpy(s,fwp->findex[a]->name,MAXLINESTR,fwp->menu.drp->sizex-30);
@@ -486,6 +488,7 @@
strftime(buf,15,"%y/%m/%d %R",tm);
strcat(s," ");
strcat(s,buf);
+ va_end(args);
}
void fw_make(fw_t *fwp)
diff -ru ne/src/menu.c ne-3+00pre16.fix/src/menu.c
--- ne/src/menu.c Mon Nov 15 18:00:00 1999
+++ ne-3+00pre16.fix/src/menu.c Fri Aug 24 21:27:44 2001
@@ -39,7 +39,7 @@
}
}
-void menu_itemmake(menu_t *mnp,void func(int,mitem_t *,void *),size_t nums,void *vp)
+void menu_itemmake(menu_t *mnp,void func(int,mitem_t *,...),size_t nums,void *vp)
{
int i;
int ln;
@@ -77,12 +77,15 @@
char *s;
} itemstr_t;
-void makelists_proc(int a,mitem_t *mip,void *vp)
+void makelists_proc(int a,mitem_t *mip,...)
{
itemstr_t *isp;
+ va_list args;
- isp=vp;
+ va_start(args,mip);
+ isp=va_arg(args,itemstr_t *);
strcpy(mip->str, isp->s +isp->width*a);
+ va_end(args);
}
void menu_itemmakelists(menu_t *mnp,size_t width,size_t num,char *s)
@@ -96,19 +99,19 @@
menu_itemmake(mnp, makelists_proc, num, &is);
}
-void makev_proc(int a,mitem_t *mip,void *vp)
+void makev_proc(int a,mitem_t *mip,...)
{
va_list args;
char *p;
- args=*(va_list *)vp;
+ va_start(args,mip);
p=va_arg(args,char *);
if (p==NULL)
strcpy(mip->str,"null"); else
strcpy(mip->str,p);
- *(va_list *)vp=args;
+ va_end(args);
}
diff -ru ne/src/setopt.c ne-3+00pre16.fix/src/setopt.c
--- ne/src/setopt.c Mon Nov 15 18:00:00 1999
+++ ne-3+00pre16.fix/src/setopt.c Fri Aug 24 21:33:03 2001
@@ -11,6 +11,7 @@
#include "ed.h"
#include "sh.h"
#include <ctype.h>
+#include <stdarg.h>
extern keydef_t keydef[MAX_region][MAXKEYDEF];
@@ -331,11 +332,14 @@
-void option_set_proc(int a,mitem_t *mip,void *vp) // !!!!
+void option_set_proc(int a,mitem_t *mip,...) // !!!!
{
char *opt_kc[]={"euc","jis","sjis"};
char *opt_rm[]={"lf","crlf","cr"};
+ va_list args;
+ va_start(args,mip);
+
switch(a)
{
case 0:
@@ -378,6 +382,7 @@
sprintf(mip->str, "%s%-12d", OPT_TAB_STOP_MSG, atoi(gval_get(sysinfo.vp_def, "TabStop")));
break;
}
+ va_end(args);
}
--yoshfuji