From: <sar...@us...> - 2009-12-14 20:25:35
|
Update of /cvsroot/ceps/ceps-providor In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv25702 Modified Files: Tag: Windows7_x64 checkdrsetting.c Log Message: Added the extra check for invalid arguments and return if the table is non-existing with error code 2 Index: checkdrsetting.c =================================================================== RCS file: /cvsroot/ceps/ceps-providor/checkdrsetting.c,v retrieving revision 1.3 retrieving revision 1.3.4.1 diff -C2 -d -r1.3 -r1.3.4.1 *** checkdrsetting.c 13 May 2009 13:28:38 -0000 1.3 --- checkdrsetting.c 14 Dec 2009 20:25:22 -0000 1.3.4.1 *************** *** 86,90 **** void help() { ! fprintf(stdout, "Usage: %s [-h] -p printername [-o outfile] [server]\n", progname); fprintf(stdout,"Exit Status : \n"); fprintf(stdout,"\tSDDB_OK 0\n"); --- 86,90 ---- void help() { ! fprintf(stdout, "Usage: %s [-h] -p printername [-o outfile] [-x 86/64] [server]\n", progname); fprintf(stdout,"Exit Status : \n"); fprintf(stdout,"\tSDDB_OK 0\n"); *************** *** 111,115 **** void usage() { ! fprintf(stderr, "Usage: %s [-h] -p printername [-o outfile] [server]\n", progname); exit(INCORRECT_USAGE); } --- 111,115 ---- void usage() { ! fprintf(stderr, "Usage: %s [-h] -p printername [-o outfile] [-x 86/64] [server]\n", progname); exit(INCORRECT_USAGE); } *************** *** 120,136 **** { int c; ! int ret_val =0; extern char *optarg; extern int optind; - char *idxname=NULL; - char *key=NULL; - char *table=NULL; outfile=stdout; ! char * outfile_name = NULL; char *printer_name = NULL; progname=argv[0]; ! while((c=getopt(argc, argv, "hp:o:")) != EOF) { switch(c) --- 120,138 ---- { int c; ! int i = 0; ! int end = 2; ! int start = 0; ! int ret_val = 0; extern char *optarg; extern int optind; outfile=stdout; ! char *outfile_name = NULL; char *printer_name = NULL; + char *arch_name = NULL; + char *drSettingFileName[3] = {"drsetting", "drsettingx64", NULL}; progname=argv[0]; ! while((c=getopt(argc, argv, "hp:o:x:")) != EOF) { switch(c) *************** *** 152,155 **** --- 154,170 ---- break; + case 'x': + if (arch_name) + usage(); + arch_name=optarg; + if ( !strcmp(arch_name,"86") ) { + end = 1; + } + else if ( !strcmp(arch_name,"64") ) { + start = 1; + } + else usage (); + break; + case '?': usage(); *************** *** 177,186 **** } ! ret_val = check_record("drsetting", "name", printer_name); ! if (ret_val == SDDB_OK) ! fprintf(outfile, "\nRETURNING SUCCESSUFUL\n"); ! else ! fprintf(outfile, "\nRETURNING ERROR %d\n", ret_val); closefile(); exit(ret_val); } --- 192,210 ---- } ! for ( i = start; i < end; i++ ) ! { ! ret_val = check_record(drSettingFileName[i], "name", printer_name); ! ! if (ret_val == SDDB_OK) { ! fprintf(outfile, "\nRETURNING SUCCESSUFUL\n"); ! } ! else ! { ! fprintf(outfile, "\nRETURNING ERROR %d\n", ret_val); ! } ! } ! // Close the output file descriptor closefile(); + exit(ret_val); } *************** *** 247,255 **** if ((main_rec=SddbRequest(DBREQ_LUEQUAL, table, idx, ownid, &seqno, key)) == NULL) { ! fprintf(outfile, "ERROR : No record with %s=%s in %s \n", idx, keyname, table); ! ret_val = MISSING_MAIN_RECORD; } else { ! main_seqno=seqno; ! strcpy(main_ownid,ownid); } --- 271,285 ---- if ((main_rec=SddbRequest(DBREQ_LUEQUAL, table, idx, ownid, &seqno, key)) == NULL) { ! if ( sddberrno == DBREPLY_BADTABLE ) ! { ! fprintf(outfile, "ERROR : The specified table not present [%s]\n", table); ! return SDDBCONNECT_FAILED; ! } else { ! fprintf(outfile, "ERROR : No record with %s=%s in %s \n", idx, keyname, table); ! ret_val = MISSING_MAIN_RECORD; ! } } else { ! main_seqno=seqno; ! strcpy(main_ownid,ownid); } *************** *** 452,456 **** for (i=0; i < nsrecs;i++) { ! fprintf("Number of sub recs %d\n", nsrecs); if (array_ids[i] < 0 || array_ids[i] > 99) { --- 482,486 ---- for (i=0; i < nsrecs;i++) { ! fprintf(outfile,"Number of sub recs %d\n", nsrecs); if (array_ids[i] < 0 || array_ids[i] > 99) { *************** *** 600,603 **** --- 630,637 ---- * $Version$ * $Log$ + * Revision 1.3.4.1 2009/12/14 20:25:22 saravanc + * Added the extra check for invalid arguments and return if the table is + * non-existing with error code 2 + * * Revision 1.3 2009/05/13 13:28:38 sanradha * checkdrsetting is modified tocheck the integrity of HP extended main *************** *** 606,609 **** --- 640,647 ---- * Revision 1.2 2006/09/01 10:07:54 sur_9999 * Added $Log$ + * Added Revision 1.3.4.1 2009/12/14 20:25:22 saravanc + * Added Added the extra check for invalid arguments and return if the table is + * Added non-existing with error code 2 + * Added * Added Revision 1.3 2009/05/13 13:28:38 sanradha * Added checkdrsetting is modified tocheck the integrity of HP extended main |