]> git.sur5r.net Git - ngadmin/blob - cli/com_defaults.c
5855332398b237a091b8924b94d0b8d6413fffe7
[ngadmin] / cli / com_defaults.c
1
2 #include "commands.h"
3
4
5
6 bool do_defaults (int nb UNUSED, const char **com UNUSED, struct ngadmin *nga) {
7  
8  int i, ret=true;
9  const struct swi_attr *sa;
10  char line[16];
11  
12  
13  if ( (sa=ngadmin_getCurrentSwitch(nga))==NULL ) {
14   printf("must be logged\n");
15   ret=false;
16   goto end;
17  }
18  
19  
20  printf("The switch settings will be CLEARED. Continue ? [y/N]: ");
21  fflush(stdout);
22  
23  if ( fgets(line, sizeof(line), stdin)!=NULL && strcasecmp(line, "y\n")==0 ) {
24   i=ngadmin_defaults(nga);
25   printErrCode(i);
26  }
27  
28  
29  end:
30  
31  return ret;
32  
33 }
34
35