@@ -166,10 +166,8 @@ int main(int argc, char *argv[])
166166{
167167 const char * ifiles [MAXIFILES ];
168168 char * mfil , * ufil , * Ofil , * ofil , * omfil , * oufil , * console ;
169- int ifilct = 0 , fd , no_m , no_u ;
169+ int ifilct , fd , no_m , no_u , restore , check_console , ret , c ;
170170 unsigned int iunit , hwunit ;
171- int restore = 0 ;
172- int ret , c ;
173171
174172 struct kfont_context * kfont ;
175173
@@ -183,6 +181,7 @@ int main(int argc, char *argv[])
183181 { "-m, --consolemap <FILE>" , _ ("load console screen map ('none' means don't load it)." ) },
184182 { "-u, --unicodemap <FILE>" , _ ("load font unicode map ('none' means don't load it)." ) },
185183 { "-C, --console <DEV>" , _ ("the console device to be used." ) },
184+ { "-c, --check" , _ ("check whether console is suitable for font operations." ) },
186185 { "-d, --double" , _ ("double size of font horizontally and vertically." ) },
187186 { "-f, --force" , _ ("force load unicode map." ) },
188187 { "-R, --reset" , _ ("reset the screen font, size, and unicode map to the bootup defaults." ) },
@@ -193,6 +192,7 @@ int main(int argc, char *argv[])
193192 };
194193
195194 const struct kbd_option opts [] = {
195+ { "=c" , "check" , kbd_no_argument , 'c' },
196196 { "=d" , "double" , kbd_no_argument , 'd' },
197197 { "=f" , "force" , kbd_no_argument , 'f' },
198198 { "=R" , "reset" , kbd_no_argument , 'R' },
@@ -218,7 +218,8 @@ int main(int argc, char *argv[])
218218
219219 ifiles [0 ] = mfil = ufil = Ofil = ofil = omfil = oufil = NULL ;
220220 iunit = hwunit = 0 ;
221- no_m = no_u = 0 ;
221+ ifilct = no_m = no_u = 0 ;
222+ restore = check_console = 0 ;
222223 console = NULL ;
223224
224225 while ((c = kbd_getopt (argc , argv , opts )) != -1 ) {
@@ -271,6 +272,9 @@ int main(int argc, char *argv[])
271272 case 'R' :
272273 restore = 1 ;
273274 break ;
275+ case 'c' :
276+ check_console = 1 ;
277+ break ;
274278 case 'd' :
275279 kfont_set_option (kfont , kfont_double_size );
276280 break ;
@@ -316,6 +320,9 @@ int main(int argc, char *argv[])
316320 if ((fd = getfd (console )) < 0 )
317321 kbd_error (EX_OSERR , 0 , _ ("Couldn't get a file descriptor referring to the console." ));
318322
323+ if (check_console )
324+ return kfont_is_font_console (kfont , fd ) ? EX_OK : EXIT_FAILURE ;
325+
319326 int kd_mode = -1 ;
320327 if (!ioctl (fd , KDGETMODE , & kd_mode ) && (kd_mode == KD_GRAPHICS )) {
321328 /*
0 commit comments