Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Pack 005c: System Evaporation #64

Merged
merged 34 commits into from
Oct 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
27e28e4
Path: Replace hardcoded special shell path `~` with `BBSHOME`
IepIweidieng Feb 24, 2020
6ee5d2d
Path/version: Replace hardcoded path `bin/` with `BINARY_SUFFIX` or `…
IepIweidieng Feb 24, 2020
fe4acd5
maple/mail.c: `m_setmboxdir()`: Remove unused buffer `fpath3`
IepIweidieng Feb 24, 2020
217a359
maple/xover.c: `z_download()`: Fix missing `argv[0]` for calling `exe…
IepIweidieng Feb 24, 2020
02dce84
visio: Add function `iac_process()`: A boundary-checking version of `…
IepIweidieng Mar 30, 2020
5c03853
visio/idle: `igetch()`: Fix crash when `select()` timeouts while `cut…
IepIweidieng Apr 1, 2020
453bd7c
Code Readability: Replace `TEMPLVAL()` with `LISTLIT()` if a lvalue i…
IepIweidieng Apr 9, 2020
bbdebf1
maple/menu.c: `domenu()`: Fix incorrect menu item length.
IepIweidieng Mar 30, 2020
cc14385
visio/term resizing: Add special key value `I_RESIZETERM`
IepIweidieng Mar 30, 2020
147ec8b
Term resizing: Simplify redrawing on resizing logic with `I_RESIZETERM`
IepIweidieng Mar 30, 2020
3e563cc
Term resizing: `vmsg()`, `pmsg()`, & `pmsg2()`: Redraw if `vkey()` re…
IepIweidieng Mar 30, 2020
57fdeda
maple/xover.c: `xover()`: Execute `XO_HEAD` command if `vkey()` retur…
IepIweidieng Mar 30, 2020
7b55348
xover: Add xover command `XO_CUR + pos` for redrawing a item and perf…
IepIweidieng Mar 30, 2020
a95b6ad
xover: Extract functions `xover_exec_cb()` & `xover_key()` from `xove…
IepIweidieng Mar 30, 2020
788661c
xover: Make command `XO_CUR` invoke the callback with key `XO_CUR`
IepIweidieng Mar 30, 2020
4e42009
xover: Simplify item redrawing with xover command `XO_CUR + pos`
IepIweidieng Mar 30, 2020
71d6505
xover: Add parameter `XO *xo` to `every_Z()`
IepIweidieng Mar 30, 2020
a82ef9d
popupmenu/term resizing: `do_menu()`: Redraw with `xo` on resizing
IepIweidieng Mar 30, 2020
46ed815
MENU/xover: Restructure main menu with xover commands
IepIweidieng Mar 31, 2020
80db704
window/term resizing: `popupmenu_ans2()`: Eliminate unneeded `grayout…
IepIweidieng Mar 31, 2020
ca25904
MENU: Refine explanation display
IepIweidieng Mar 31, 2020
2fed72f
MENU: union `MenuItem`: Fix wrong usage documentation
IepIweidieng Apr 8, 2020
859c7fb
MENU: union `MenuItem`: Replace member `dlfunc` with `dl` of the new …
IepIweidieng Apr 9, 2020
103a1d6
MENU: Unify the spacial values of the main menu system and the popupm…
IepIweidieng Oct 5, 2020
cafca07
Add function `XoPostSimple` for entering a board without showing the …
IepIweidieng Oct 5, 2020
2e9c2df
`system()` avoidance: Add `lib/proc.c` for process manipulation
IepIweidieng Oct 5, 2020
526cd16
`system()` avoidance: Replace `system()` of simple commands with `PRO…
IepIweidieng Oct 5, 2020
2718776
`system()` avoidance: Add `proc_run*_bg()` & `PROC_CMD_BG()` for runn…
IepIweidieng Oct 5, 2020
5fc422a
`system()` avoidance: Replace `system()` of background tasks with `PR…
IepIweidieng Oct 5, 2020
e461c8b
pfterm: `fterm_exec()`: Parse SGR 38 & SGR 48 (both ECMA-48-style and…
IepIweidieng Mar 30, 2020
9dac51d
Fix pmore hanging by making pmore handle `'\0'`
IepIweidieng Oct 6, 2020
d107885
maple/post.c: `post_lock()`: Add warning messages for users unable to…
IepIweidieng Oct 6, 2020
3058115
mailpost: `post_article()`: Fix mailpost ignores the bottomed posts
IepIweidieng Oct 6, 2020
ebc07f2
Multi-login: Log kicked client's pid in the kick log
IepIweidieng Oct 6, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions include/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,6 @@
#define MENU_YPOS 13
#define MENU_XPOS_REF ((D_COLS_REF >> 1) + 23) /* For `get[y|x]_ref()` & `move_ref()` */
#define MENU_YPOS_REF 13
#define MENU_LOAD 1
#define MENU_DRAW 2
#define MENU_FILM 4

/* ----------------------------------------------------- */
/* �t�ΰѼ� */
Expand Down
13 changes: 13 additions & 0 deletions include/dao.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,24 @@ char *Ctime(const time_t *clock);
char *Etime(const time_t *clock);
char *Atime(const time_t *clock);
char *Now(void);
/* proc.c */
int proc_runv(const char *path, const char *argv[]);
GCC_CHECK_SENTINEL(0) int proc_runl(const char *path, const char *arg0, ...);
int proc_runv_bg(const char *path, const char *argv[]);
GCC_CHECK_SENTINEL(0) int proc_runl_bg(const char *path, const char *arg0, ...);
/* xwrite.c */
int xwrite(int fd, const char *data, int size);

#ifdef __cplusplus
} /* extern "C" */
#endif

/* `proc_runl` without the need of `arg0` and trailing `NULL` */
/* Use `PROC_CMD(path, NULL)` when no other arguments are needed */
#define PROC_CMD(path, ...) proc_runl(path, path, __VA_ARGS__, NULL)

/* `proc_runl_bg` without the need of `arg0` and trailing `NULL` */
/* Use `PROC_CMD_BG(path, NULL)` when no other arguments are needed */
#define PROC_CMD_BG(path, ...) proc_runl_bg(path, path, __VA_ARGS__, NULL)

#endif /* DAO_H */
2 changes: 1 addition & 1 deletion include/dns.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ typedef union
struct sockaddr_in6 v6;
} ip_addr; /* SHMDATA(raw); dependency(UTMP) */

#define IPADDR_NONE TEMPLVAL(ip_addr, {0})
#define IPADDR_NONE LISTLIT(ip_addr){0}

/*
* The standard udp packet size PACKETSZ (512) is not sufficient for some
Expand Down
2 changes: 2 additions & 0 deletions include/global.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@
#define I_TIMEOUT 0x04FD
#define I_OTHERDATA 0x04FE

#define I_RESIZETERM Meta(Ctrl('L'))

#define KEY_NONE 0x4000 /* All key values should `< KEY_NONE` */

#define Ctrl(c) ( c & ~0x0060 )
Expand Down
54 changes: 40 additions & 14 deletions include/modes.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#ifndef MODES_H
#define MODES_H

#include "perm.h"

enum
{STRIP_ALL, ONLY_COLOR, NO_RELOAD};

Expand All @@ -21,15 +23,8 @@ enum
/* user �ާ@���A�P�Ҧ� */
/* ----------------------------------------------------- */

#if NO_SO
#define M_DL(umode) (umode)
#else
#define M_DL(umode) (-(umode)) /* For dynamic library loading */
#endif

#define M_ARG 0x40000000 /* `item` is a function and a `void *` argument */

#define M_MASK 0x0000FFFF /* Mask for valid user modes */
#define M_MENU M_MMENU /* The first menu mode */
#define M_FUN M_PROFESS /* The first non-menu, non-idle mode */

#define M_IDLE 0
#define M_MMENU 1 /* menu mode */
Expand Down Expand Up @@ -135,13 +130,36 @@ static const char *const ModeTypeTable[] =


/* ----------------------------------------------------- */
/* menu.c �����Ҧ� */
/* menu.c & popupmenu.c �����Ҧ� */
/* ----------------------------------------------------- */

/* For `umode` */

#if NO_SO
#define M_DL(umode) (umode)
#else
#define M_DL(umode) ((umode) | 0x80000000) /* For dynamic library loading */
#endif

#define M_QUIT 0x01000000 /* Return to the outer menu after selection */
#define M_XO 0x02000000 /* `item` is a xover function */
#define M_ARG 0x04000000 /* `item` is a function and a `void *` argument */

#define M_DOINSTANT 0x00010000 /* Immidiately select a menu item after command match */
#define M_MENUTITLE 0x00020000 /* `item` is a string for the menu title */
#define M_TAIL_MASK 0x00FF0000 /* Mask for the flags which indicate the menu list tail */

#define M_MASK 0x0000FFFF /* Mask for valid user modes */

#define XEASY 0x333 /* Return value to un-redraw screen */
#define QUIT 0x666 /* Return value to abort recursive functions */
#define SKIN 0x999 /* Return value to change skin */
/* For `level` */

#define PERM_MENU PERM_PURGE /* A permission flag reserved for valid users */

/* Traditional return values */

#define XEASY XO_FOOT /* Return value to un-redraw screen */
#define QUIT XO_QUIT /* Return value to abort recursive functions */
#define SKIN XO_SKIN /* Return value to change skin */


/* ----------------------------------------------------- */
Expand Down Expand Up @@ -244,6 +262,12 @@ static const char *const ModeTypeTable[] =
#define XO_LAST ((XZ_ZONE | XZ_BACK) + XO_NONE)
#define XO_QUIT ((XZ_ZONE | XZ_QUIT) + XO_NONE)

/* Miscellaneous commands ({XO_WRAP|XO_SCRL|XO_REL} + key; key <= KEY_NONE) */
#define XO_CUR (XO_REL + XO_CUR_BIAS) /* Redraw the item under the cursor and do relative move */
#define XO_CUR_BIAS 0x2000 /* Bias of relative move */
#define XO_CUR_MIN (XO_REL + 0) /* The minimum value of relative move */
#define XO_CUR_MAX (XO_REL + KEY_NONE) /* The maximum value of relative move */

/* Special values */

//#define XO_RSIZ 256 /* max record length */ /* IID.20200102: Unlimited. */
Expand Down Expand Up @@ -272,10 +296,12 @@ static const char *const ModeTypeTable[] =
#define XZ_FINI 0x02000000 /* Perform finalization tasks for a zone */
#define XZ_BACK 0x04000000 /* Return to the last zone */
#define XZ_QUIT 0x08000000 /* Exit `xover()` */
#define XZ_UNUSED4 0x10000000
#define XZ_SKIN 0x10000000 /* Change the skin instead of the zone */

#define XZ_UNUSED5 0x20000000

#define XO_ZONE (XZ_ZONE + XO_MOVE)
#define XO_SKIN ((XZ_ZONE | XZ_SKIN) + XO_MOVE)

/* Zone indexes */

Expand Down
22 changes: 10 additions & 12 deletions include/popup.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,19 @@
#ifndef POPUP_H
#define POPUP_H

#define POPUP_QUIT 0x00
#define POPUP_FUN 0x01
#define POPUP_XO 0x02
#define POPUP_MENU 0x04
#define POPUP_MENUTITLE 0x08
#include "modes.h"

#define POPUP_QUIT M_QUIT
#define POPUP_FUN M_FUN
#define POPUP_XO (M_FUN | M_XO)
#define POPUP_MENU M_MENU
#define POPUP_MENUTITLE (M_MENU | M_MENUTITLE)
#if NO_SO
#define POPUP_SO POPUP_FUN
#define POPUP_SO M_FUN
#else
#define POPUP_SO 0x10 /* For dynamic library loading */
#define POPUP_SO M_DL(M_FUN) /* For dynamic library loading */
#endif

#define POPUP_DO_INSTANT 0x01000000

#define POPUP_ARG 0x40000000 /* `item` is a function and a `void *` argument */

#define POPUP_MASK 0x000000FF
#define POPUP_ARG M_ARG /* `item` is a function and a `void *` argument */

#endif /* #ifndef POPUP_H */
8 changes: 7 additions & 1 deletion include/proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ void brd_edit(int bno);
int a_editbrd(void);
int u_verify(void);
/* bbsd.c */
void blog_pid(const char *mode, const char *msg, pid_t pid);
void blog(const char *mode, const char *msg);
void u_exit(const char *mode);
GCC_NORETURN void abort_bbs(void);
Expand All @@ -89,6 +90,7 @@ int Ben_Perm(const BRD *bhdr, unsigned int ulevel);
GCC_PURE int bstamp2bno(time_t stamp);
void brh_load(void);
void brh_save(void);
bool XoPostSimple(int bno);
bool XoPost(int bno);
void board_outs(int chn, int num);
void class_outs(const char *title, int num);
Expand Down Expand Up @@ -173,6 +175,7 @@ void vs_mid(const char *mid);
void vs_head(const char *title, const char *mid);
void clear_notification(void);
void movie(void);
GCC_PURE int strip_ansi_n_len(const char *str, int maxlen);
GCC_PURE int strip_ansi_len(const char *str);
const char *check_info(const char *input);
void main_menu(void);
Expand Down Expand Up @@ -313,6 +316,7 @@ void grayoutrect(int y, int yend, int x, int xend, int level);
void grayout(int y, int end, int level);
#endif /* #ifndef M3_USE_PFTERM */
void add_io(int fd, int timeout);
int iac_process(const unsigned char *current, const unsigned char *end, int *pcount);
int iac_count(const unsigned char *current);
int igetch(void);
BRD *ask_board(char *board, unsigned int perm, const char *msg);
Expand Down Expand Up @@ -343,7 +347,9 @@ int xo_cb_foot(XO *xo);
int xo_cb_last(XO *xo);
int xo_cb_quit(XO *xo);
void xover(int cmd);
void every_Z(void);
int xover_exec_cb(XO *xo, int cmd);
int xover_key(XO *xo, int zone, int cmd);
void every_Z(XO *xo);
void every_U(void);
void every_B(void);
void every_S(void);
Expand Down
49 changes: 33 additions & 16 deletions include/struct.h
Original file line number Diff line number Diff line change
Expand Up @@ -1096,42 +1096,59 @@ typedef struct PostRecommendHistory
#endif /* #if 0 */

typedef struct {
int (*func)(const void *arg);
union {
int (*func)(const void *arg);
int (*xofunc)(XO *xo, const void *arg);
};
const void *arg;
} FuncArg;

typedef struct {
union {
#if NO_SO
int (*func)(const void *arg);
int (*func)(const void *arg);
int (*xofunc)(XO *xo, const void *arg);
#else
const char *func;
const char *func;
const char *xofunc;
#endif
};
const void *arg;
} DlFuncArg;

typedef union { /* The field to be used is determined by the value of `umode` */
int (*func) (void); /* Default (menu) or `POPUP_FUN` (popupmenu) */
FuncArg funcarg; /* `umode | M_ARG` (menu) or `umode | POPUP_FUN` (popupmenu) */

int (*xofunc) (XO *xo); /* `POPUP_XO` (popupmenu) */


typedef union {
/* The field to be used is determined by the value of `umode` */
#if NO_SO
int (*dlfunc) (void); /* `M_DL(umode)` (menu & popupmenu) or `POPUP_SO` (popupmenu) */
int (*func) (void); /* `M_DL(umode)`, `umode` `>= M_FUN` or `M_IDLE` */
int (*xofunc) (XO *xo); /* `M_DL(umode | M_XO)` */
const char *title; /* `M_DL(umode | M_MENUTITLE)` */
struct MENU *menu; /* `M_DL(umode)`, `umode` `>= M_MENU` and `< M_FUN` */
#else
const char *dlfunc;
const char *func;
const char *xofunc;
const char *title;
const char *menu;
#endif
DlFuncArg dlfuncarg; /* `M_DL(umode | M_ARG)` (menu) or `POPUP_SO | POPUP_ARG)` (popupmenu) */
} DlMenuItem;

typedef union {
/* The field to be used is determined by the value of `umode` */
int (*func) (void); /* `>= M_FUN` or `M_IDLE` */
int (*xofunc) (XO *xo); /* `umode | M_XO` */
FuncArg funcarg; /* `umode | M_ARG` */

DlMenuItem dl; /* `M_DL(umode)` */
DlFuncArg dlfuncarg; /* `M_DL(umode) | M_ARG` */

const char *title; /* `POPUP_MENUTITLE` (popupmenu) */
struct MENU *menu; /* `<= M_XMENU` (menu) or `POPUP_MENU` (popupmenu) */
const char *title; /* `umode | M_MENUTITLE` */
struct MENU *menu; /* `>= M_MENU` and `< M_FUN` */
} MenuItem;

typedef struct MENU
{
MenuItem item;
unsigned int level;
int umode;
unsigned int umode;
const char *desc;
} MENU;

Expand Down
1 change: 1 addition & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ add_library(dao STATIC
acl.c chrono32.c file.c isnot.c radix32.c shm.c
archiv32.c dl_lib.c record.c splay.c date_str.c xsort.c
attr_lib.c dns.c header.c rfc2047.c string.c xwrite.c
proc.c
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
target_link_libraries(dao PRIVATE -m32)
Expand Down
6 changes: 4 additions & 2 deletions lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ HDR = dao.h dao.p

SRC = acl.c chrono32.c file.c isnot.c radix32.c shm.c \
archiv32.c dl_lib.c record.c splay.c date_str.c xsort.c \
attr_lib.c dns.c header.c rfc2047.c string.c xwrite.c
attr_lib.c dns.c header.c rfc2047.c string.c xwrite.c \
proc.c

OBJ = acl.o chrono32.o file.o isnot.o radix32.o shm.o \
archiv32.o dl_lib.o record.o splay.o date_str.o xsort.o \
attr_lib.o dns.o header.o rfc2047.o string.o xwrite.o
attr_lib.o dns.o header.o rfc2047.o string.o xwrite.o \
proc.o

.c.o: ;$(CC) $(CFLAGS) -c $*.c

Expand Down
Loading