| 1 |
/*************************************************************************** |
/*************************************************************************** |
| 2 |
common.c - description |
common.c - description |
| 3 |
------------------- |
------------------- |
| 4 |
begin : Mon Oct 18 2004 |
Copyright : (C) 2004-2025 by Leaflet |
| 5 |
copyright : (C) 2004 by Leaflet |
Email : leaflet@leafok.com |
|
email : leaflet@leafok.com |
|
| 6 |
***************************************************************************/ |
***************************************************************************/ |
| 7 |
|
|
| 8 |
/*************************************************************************** |
/*************************************************************************** |
| 9 |
* * |
* * |
| 10 |
* This program is free software; you can redistribute it and/or modify * |
* This program is free software; you can redistribute it and/or modify * |
| 11 |
* it under the terms of the GNU General Public License as published by * |
* it under the terms of the GNU General Public License as published by * |
| 12 |
* the Free Software Foundation; either version 2 of the License, or * |
* the Free Software Foundation; either version 3 of the License, or * |
| 13 |
* (at your option) any later version. * |
* (at your option) any later version. * |
| 14 |
* * |
* * |
| 15 |
***************************************************************************/ |
***************************************************************************/ |
| 93 |
void reload_bbs_menu(int i) |
void reload_bbs_menu(int i) |
| 94 |
{ |
{ |
| 95 |
if (reload_menu(&bbs_menu) < 0) |
if (reload_menu(&bbs_menu) < 0) |
| 96 |
|
{ |
| 97 |
log_error("Reload menu failed\n"); |
log_error("Reload menu failed\n"); |
| 98 |
|
} |
| 99 |
else |
else |
| 100 |
|
{ |
| 101 |
log_std("Reload menu successfully\n"); |
log_std("Reload menu successfully\n"); |
| 102 |
|
} |
| 103 |
} |
} |
| 104 |
|
|
| 105 |
void system_exit(int i) |
void system_exit(int i) |
| 119 |
log_std("Child process (%d) exited\n", pid); |
log_std("Child process (%d) exited\n", pid); |
| 120 |
} |
} |
| 121 |
} |
} |
| 122 |
|
|
| 123 |
|
const char * ip_mask(char * s, int level, char mask) |
| 124 |
|
{ |
| 125 |
|
char * p = s; |
| 126 |
|
|
| 127 |
|
if (level <= 0) |
| 128 |
|
{ |
| 129 |
|
return s; |
| 130 |
|
} |
| 131 |
|
if (level > 4) |
| 132 |
|
{ |
| 133 |
|
level = 4; |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
for (int i = 0; i < 4 - level; i++) |
| 137 |
|
{ |
| 138 |
|
p = strchr(p, '.'); |
| 139 |
|
if (p == NULL) |
| 140 |
|
{ |
| 141 |
|
return s; |
| 142 |
|
} |
| 143 |
|
p++; |
| 144 |
|
} |
| 145 |
|
|
| 146 |
|
for (int i = 0; i < level; i++) |
| 147 |
|
{ |
| 148 |
|
*p = mask; |
| 149 |
|
p++; |
| 150 |
|
if (i < level - 1) |
| 151 |
|
{ |
| 152 |
|
*p = '.'; |
| 153 |
|
p++; |
| 154 |
|
} |
| 155 |
|
} |
| 156 |
|
*p = '\0'; |
| 157 |
|
|
| 158 |
|
return s; |
| 159 |
|
} |