1 /*
2 ** doswitch.c for elfsh
3 **
4 ** Started on  Sat Jan 25 11:20:49 2003 mayhem
5 ** Last update Wed Feb 26 15:56:41 2003 mayhem
6 */
7 #include "elfsh.h"
8 
9 
10 /* Change the current object */
cmd_doswitch()11 int		cmd_doswitch()
12 {
13   elfshobj_t	*actual;
14   int		nbr;
15 
16   if (world.args.param[0] == NULL)
17     return (-1);
18   nbr = atoi(world.args.param[0]);
19   actual = (nbr ? vm_getfile(nbr) : hash_get(&file_hash, world.args.param[0]));
20   if (actual == NULL)
21     {
22       printf("\n [!] Cant switch on file object %s (use 'list') \n\n",
23 	     world.args.param[0]);
24       return (-1);
25     }
26 
27   printf("\n [*] Switched on object %u (%s) \n\n", actual->id, actual->name);
28   world.current = actual;
29   return (0);
30 }
31