|
From: Patrick M. <ume...@us...> - 2008-08-01 00:21:46
|
Update of /cvsroot/radmind/radmind In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv32499 Modified Files: ktcheck.c lapply.c Log Message: Add -e to ktcheck and lapply to allow changing the event type that is reported to the radmind server. [Patch #1951140] Thanks Karl Kuehn of Stanford University for the patch. Index: lapply.c =================================================================== RCS file: /cvsroot/radmind/radmind/lapply.c,v retrieving revision 1.146 retrieving revision 1.147 diff -C2 -d -r1.146 -r1.147 *** lapply.c 7 Jun 2008 14:26:54 -0000 1.146 --- lapply.c 1 Aug 2008 00:21:42 -0000 1.147 *************** *** 251,258 **** int force = 0; int use_randfile = 0; ! char **capa = NULL; /* capabilities */ while (( c = getopt( argc, argv, ! "%c:CFh:iInp:P:qru:Vvw:x:y:z:Z:" )) != EOF ) { switch( c ) { case '%': --- 251,259 ---- int force = 0; int use_randfile = 0; ! char **capa = NULL; /* capabilities */ ! char * event = "lapply"; /* report event type */ while (( c = getopt( argc, argv, ! "%c:Ce:Fh:iInp:P:qru:Vvw:x:y:z:Z:" )) != EOF ) { switch( c ) { case '%': *************** *** 274,277 **** --- 275,282 ---- break; + case 'e': /* set the event label for reporting */ + event = optarg; + break; + case 'F': force = 1; *************** *** 729,733 **** if ( network ) { if ( report ) { ! if ( report_event( sn, "lapply", "Changes applied successfully" ) != 0 ) { fprintf( stderr, "warning: could not report event\n" ); --- 734,738 ---- if ( network ) { if ( report ) { ! if ( report_event( sn, event, "Changes applied successfully" ) != 0 ) { fprintf( stderr, "warning: could not report event\n" ); *************** *** 754,759 **** if ( change ) { if ( network && report ) { ! if ( report_event( sn, "lapply", ! "Error, changes made" ) != 0 ) { fprintf( stderr, "warning: could not report event\n" ); } --- 759,763 ---- if ( change ) { if ( network && report ) { ! if ( report_event( sn, event, "Error, changes made" ) != 0 ) { fprintf( stderr, "warning: could not report event\n" ); } *************** *** 761,765 **** } else { if ( network && report ) { ! if ( report_event( sn, "lapply", "Error, no changes made" ) != 0 ) { fprintf( stderr, "warning: could not report event\n" ); --- 765,769 ---- } else { if ( network && report ) { ! if ( report_event( sn, event, "Error, no changes made" ) != 0 ) { fprintf( stderr, "warning: could not report event\n" ); Index: ktcheck.c =================================================================== RCS file: /cvsroot/radmind/radmind/ktcheck.c,v retrieving revision 1.135 retrieving revision 1.136 diff -C2 -d -r1.135 -r1.136 *** ktcheck.c 27 Jun 2008 17:00:30 -0000 1.135 --- ktcheck.c 1 Aug 2008 00:21:42 -0000 1.136 *************** *** 55,59 **** int createspecial( SNET *sn, struct list *special_list ); int getstat( SNET *sn, char *description, char *stats ); ! int read_kfile( char * ); SNET *sn; --- 55,59 ---- int createspecial( SNET *sn, struct list *special_list ); int getstat( SNET *sn, char *description, char *stats ); ! int read_kfile( char *, char * ); SNET *sn; *************** *** 564,570 **** char tempfile[ MAXPATHLEN ]; char **capa = NULL; /* capabilities */ while (( c = getopt( argc, argv, ! "Cc:D:h:IiK:np:P:qrvVw:x:y:z:Z:" )) != EOF ) { switch( c ) { case 'C': /* clean up dir containing command.K */ --- 564,571 ---- char tempfile[ MAXPATHLEN ]; char **capa = NULL; /* capabilities */ + char *event = "ktcheck"; /* report event type */ while (( c = getopt( argc, argv, ! "Cc:D:e:h:IiK:np:P:qrvVw:x:y:z:Z:" )) != EOF ) { switch( c ) { case 'C': /* clean up dir containing command.K */ *************** *** 586,589 **** --- 587,594 ---- break; + case 'e': /* set the event label for reporting */ + event = optarg; + break; + case 'h': host = optarg; *************** *** 764,772 **** case 2: ! if ( report ) report_event( sn, "ktcheck", "Error" ); exit( 2 ); } ! if ( read_kfile( base_kfile ) != 0 ) { exit( 2 ); } --- 769,781 ---- case 2: ! if ( report ) { ! if ( report_event( sn, event, "Error" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); ! } ! } exit( 2 ); } ! if ( read_kfile( base_kfile, event ) != 0 ) { exit( 2 ); } *************** *** 882,886 **** if ( update ) { if ( report ) { ! if ( report_event( sn, "ktcheck", "Updates retrieved" ) != 0 ) { fprintf( stderr, "warning: could not report event\n" ); } --- 891,895 ---- if ( update ) { if ( report ) { ! if ( report_event( sn, event, "Updates retrieved" ) != 0 ) { fprintf( stderr, "warning: could not report event\n" ); } *************** *** 888,892 **** } else { if ( report ) { ! if ( report_event( sn, "ktcheck", "Updates available" ) != 0 ) { fprintf( stderr, "warning: could not report event\n" ); } --- 897,901 ---- } else { if ( report ) { ! if ( report_event( sn, event, "Updates available" ) != 0 ) { fprintf( stderr, "warning: could not report event\n" ); } *************** *** 895,899 **** } else { if ( report ) { ! if ( report_event( sn, "ktcheck", "No updates needed" ) != 0 ) { fprintf( stderr, "warning: could not report event\n" ); } --- 904,908 ---- } else { if ( report ) { ! if ( report_event( sn, event, "No updates needed" ) != 0 ) { fprintf( stderr, "warning: could not report event\n" ); } *************** *** 915,919 **** int ! read_kfile( char * kfile ) { int ac, minus = 0; --- 924,928 ---- int ! read_kfile( char * kfile, char * event ) { int ac, minus = 0; *************** *** 987,994 **** break; case 2: ! if ( report ) report_event( sn, "ktcheck", "Error" ); goto error; } ! if ( read_kfile( path ) != 0 ) { exit( 2 ); } --- 996,1007 ---- break; case 2: ! if ( report ) { ! if ( report_event( sn, event, "Error" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); ! } ! } goto error; } ! if ( read_kfile( path, event ) != 0 ) { exit( 2 ); } *************** *** 1024,1028 **** break; case 2: ! if ( report ) report_event( sn, "ktcheck", "Error" ); exit( 2 ); } --- 1037,1045 ---- break; case 2: ! if ( report ) { ! if ( report_event( sn, event, "Error" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); ! } ! } exit( 2 ); } *************** *** 1049,1053 **** } if ( !update && change ) { ! if ( report ) report_event( sn, "ktcheck", "Updates available" ); exit( 1 ); } --- 1066,1074 ---- } if ( !update && change ) { ! if ( report ) { ! if ( report_event( sn, event, "Updates available" ) != 0 ) { ! fprintf( stderr, "warning: could not report event\n" ); ! } ! } exit( 1 ); } |