ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/saidar/saidar.c
(Generate patch)

Comparing projects/libstatgrab/src/saidar/saidar.c (file contents):
Revision 1.17 by ats, Fri Nov 7 18:38:48 2003 UTC vs.
Revision 1.26 by tdb, Sun Apr 4 22:48:51 2004 UTC

# Line 1 | Line 1
1   /*
2   * i-scream central monitoring system
3   * http://www.i-scream.org
4 < * Copyright (C) 2000-2002 i-scream
4 > * Copyright (C) 2000-2004 i-scream
5   *
6   * This program is free software; you can redistribute it and/or
7   * modify it under the terms of the GNU General Public License
# Line 16 | Line 16
16   * You should have received a copy of the GNU General Public License
17   * along with this program; if not, write to the Free Software
18   * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 + *
20 + * $Id$
21   */
22  
23   #ifdef HAVE_CONFIG_H
# Line 425 | Line 427 | void usage(char *progname){
427   int main(int argc, char **argv){
428  
429          extern char *optarg;
428        extern int optind;
430          int c;
431  
432          time_t last_update = 0;
# Line 435 | Line 436 | int main(int argc, char **argv){
436          extern int errno;
437  
438          int delay=2;
439 < #ifdef ALLBSD
439 <        gid_t gid;
440 < #endif
439 >
440          statgrab_init();
441 < #ifdef ALLBSD
442 <        if((setegid(getgid())) != 0){
444 <                fprintf(stderr, "Failed to lose setgid'ness\n");
441 >        if(statgrab_drop_privileges() != 0){
442 >                fprintf(stderr, "Failed to drop setuid/setgid privileges\n");
443                  return 1;
444          }
447 #endif
445                  
446          while ((c = getopt(argc, argv, "vhd:")) != -1){
447                  switch (c){
448                          case 'd':
449                                  delay = atoi(optarg);
450 <                                if (delay == 0){
450 >                                if (delay < 1){
451                                          fprintf(stderr, "Time must be 1 second or greater\n");
452                                          exit(1);
453                                  }
457                                delay--;
454                                  break;
455                          case 'v':
456                                  version_num(argv[0]);  
# Line 464 | Line 460 | int main(int argc, char **argv){
460                                  usage(argv[0]);
461                                  return 1;
462                                  break;
467                                
463                  }
464          }
465  
# Line 490 | Line 485 | int main(int argc, char **argv){
485                  int ch = getch();
486  
487                  if (ch == 'q'){
488 <                        endwin();
494 <                        return 0;
488 >                        break;
489                  }
490  
491                  /* To keep the numbers slightly accurate we do not want them

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines