Magellan Linux

Diff of /trunk/mkinitrd-magellan/busybox/console-tools/deallocvt.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 815 by niro, Sat Sep 1 22:45:15 2007 UTC revision 816 by niro, Fri Apr 24 18:33:46 2009 UTC
# Line 10  Line 10 
10    
11  /* no options, no getopt */  /* no options, no getopt */
12    
13  #include "busybox.h"  #include "libbb.h"
14    
15  /* From <linux/vt.h> */  /* From <linux/vt.h> */
16  enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */  enum { VT_DISALLOCATE = 0x5608 }; /* free memory associated to vt */
17    
18  int deallocvt_main(int argc, char *argv[])  int deallocvt_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
19    int deallocvt_main(int argc UNUSED_PARAM, char **argv)
20  {  {
21   /* num = 0 deallocate all unused consoles */   /* num = 0 deallocate all unused consoles */
22   int num = 0;   int num = 0;
23    
24   switch (argc) {   if (argv[1]) {
25   case 2:   if (argv[2])
26   num = xatoul_range(argv[1], 1, 63);   bb_show_usage();
27   /* Fallthrough */   num = xatou_range(argv[1], 1, 63);
  case 1:  
  break;  
  default:  
  bb_show_usage();  
28   }   }
29    
30   if (-1 == ioctl(get_console_fd(), VT_DISALLOCATE, num)) {   /* double cast suppresses "cast to ptr from int of different size" */
31   bb_perror_msg_and_die("VT_DISALLOCATE");   xioctl(get_console_fd_or_die(), VT_DISALLOCATE, (void *)(ptrdiff_t)num);
  }  
32   return EXIT_SUCCESS;   return EXIT_SUCCESS;
33  }  }

Legend:
Removed from v.815  
changed lines
  Added in v.816