--- gpm-1.20.7.orig/src/prog/gpm-root.y	2012-10-26 23:21:38.000000000 +0200
+++ gpm-1.20.7/src/prog/gpm-root.y	2026-05-13 18:43:02.522813736 +0200
@@ -56,6 +56,9 @@
 #define minor(dev) ((dev)&0xff)
 #endif
 
+#ifndef SA_INTERRUPT
+#define SA_INTERRUPT 0
+#endif
 
 #define GPM_NULL_DEV "/dev/null"
 
@@ -128,7 +131,7 @@ typedef struct DrawItem {
    char *name;
    char *arg;   /* a cmd string */
    void *clientdata;  /* a (Draw *) for menus or whatever   */
-   int (*fun)();
+   int (*fun)(int, struct DrawItem *, int);
    struct DrawItem *next;
 } DrawItem;
 
@@ -159,7 +162,7 @@ int yyerror(char *s);
 int yylex(void);
 
 DrawItem *cfg_cat(DrawItem *, DrawItem *);
-DrawItem *cfg_makeitem(int mode, char *msg, int(*fun)(), void *detail);
+DrawItem *cfg_makeitem(int mode, char *msg, int(*fun)(int,  DrawItem *, int), void *detail);
 
 
 /*===================================================================*
@@ -195,7 +198,7 @@ int f_pipe(int mode, DrawItem *self, int
       char *string;
       Draw *draw;
       DrawItem *item;
-      int (*fun)();
+      int (*fun)(int,  DrawItem *, int);
       }
 
 %token <string> T_STRING
@@ -284,7 +287,7 @@ struct tokenName tokenList[] = {
 struct funcName {
    char *name;
    int token;
-   int (*fun)();
+   int (*fun)(int,  DrawItem *, int);
    };
 struct funcName funcList[] = {
    {"f.debug",T_FUNC,f_debug},
@@ -390,7 +393,7 @@ Draw *cfg_alloc(void)
 
 /*---------------------------------------------------------------------*/
 /* malloc an empty DrawItem and fill it */
-DrawItem *cfg_makeitem(int mode, char *msg, int(*fun)(), void *detail)
+DrawItem *cfg_makeitem(int mode, char *msg, int(*fun)(int,  DrawItem *, int), void *detail)
 {
    DrawItem *new=calloc(1,sizeof(DrawItem));
 
@@ -405,7 +408,7 @@ DrawItem *cfg_makeitem(int mode, char *m
 
       case 'F': /* a function without args */
          new->fun=fun;
-         if (fun) fun(F_CREATE,new);
+         if (fun) fun(F_CREATE,new,0);
          break;
 
       case 'M':
@@ -939,7 +942,7 @@ static unsigned short clear_sel_args[6]=
 static unsigned char *clear_sel_arg= (unsigned char *)clear_sel_args+1;
 
 /*------------*/
-static inline void scr_dump(int fd, FILE *f, unsigned char *buffer, int vc)
+static inline void gpm_scr_dump(int fd, FILE *f, unsigned char *buffer, int vc)
 {
    int dumpfd;
    char dumpname[20];
@@ -958,7 +961,7 @@ static inline void scr_dump(int fd, FILE
 }
 
 /*------------*/
-static inline void scr_restore(int fd, FILE *f, unsigned char *buffer, int vc)
+static inline void gpm_scr_restore(int fd, FILE *f, unsigned char *buffer, int vc)
 {
    int x,y, dumpfd;
    char dumpname[20];
@@ -1002,7 +1005,7 @@ Posted *postmenu(int fd, FILE *f, Draw *
    if (!new) return NULL;
    new->draw=draw;
    new->dump=dump=malloc(opt_buf);
-   scr_dump(fd,f,dump,console);
+   gpm_scr_dump(fd,f,dump,console);
    lines=dump[0]; columns=dump[1];
    i=(columns*dump[3]+dump[2])*2+1; /* where to get it */
    if (i<0) i=1;
@@ -1047,7 +1050,7 @@ Posted *postmenu(int fd, FILE *f, Draw *
    }
    /* sides and items */
    for (item=draw->menu; y++, item; item=item->next) {
-         if (item->fun) (*(item->fun))(F_POST,item);
+         if (item->fun) (*(item->fun))(F_POST,item,0);
          GOTO(x,y); PUTC(VERLINE,draw->bord,draw->back);
          for (i=0;i<item->pad;i++) PUTC(' ',draw->fore,draw->back);
          PUTS(item->name,draw->fore,draw->back); i+=strlen(item->name);
@@ -1060,7 +1063,7 @@ Posted *postmenu(int fd, FILE *f, Draw *
    for (i=0; i<draw->width; i++) PUTC(HORLINE,draw->bord,draw->back);
    PUTC(LRCORNER,draw->bord,draw->back);
 
-   scr_restore(fd,f,dump,console);
+   gpm_scr_restore(fd,f,dump,console);
    free(dump);
 
 #undef PUTC
@@ -1077,7 +1080,7 @@ Posted *unpostmenu(int fd, FILE *f, Post
 {
    Posted *prev=which->prev;
 
-   scr_restore(fd,f,which->dump, vc);
+   gpm_scr_restore(fd,f,which->dump, vc);
    ioctl(fd,TCXONC,TCOON); /* activate the console */  
    free(which->dump);
    free(which);
@@ -1196,11 +1199,7 @@ int main(int argc, char **argv)
                                                         LOG_DAEMON : LOG_USER);
    /* reap your zombies */
    childaction.sa_handler=reap_children;
-#if defined(__GLIBC__)
-   __sigemptyset(&childaction.sa_mask);
-#else /* __GLIBC__ */
-   childaction.sa_mask=0;
-#endif /* __GLIBC__ */
+   sigemptyset(&childaction.sa_mask);
    childaction.sa_flags=SA_INTERRUPT; /* need to break the select() call */
    sigaction(SIGCHLD,&childaction,NULL);
 
