--- mstools/samples/rpc/dict/play.c 2018/08/09 18:20:01 1.1 +++ mstools/samples/rpc/dict/play.c 2018/08/09 18:22:06 1.1.1.3 @@ -2,7 +2,7 @@ /** **/ /** Microsoft RPC Examples **/ /** Dictionary Application **/ -/** Copyright(c) Microsoft Corp. 1991 **/ +/** Copyright(c) Microsoft Corp. 1992 **/ /** **/ /*************************************************************/ @@ -21,12 +21,23 @@ ************************************************************************* */ +#define INCL_DOS + #include #include #include #include #include + +#ifdef NTENV #include +// #define printf DbgPrint +#endif // NTENV + +// #include +// #include +// #include +// #include #include "dict0.h" #include "play.h" @@ -34,6 +45,8 @@ #define TAB_STOPS 3 +// handle_t dict_bhandle; + void Usage() { printf("Usage : play \n\n"); @@ -47,17 +60,17 @@ void Usage() void Usage_Msg() { - printf("Usage: \nType a single character, followed by an optional key as follows:\n\n"); - printf("i :: Insert into dictionary\n"); - printf("d :: Delete from dictionary\n"); - printf("f :: Find in dictionary\n"); - printf("n :: Next of local current item in dictionary\n"); - printf("p :: Previous of local current item in dictionary\n"); - printf("h :: Head (first item) of dictionary\n"); - printf("t :: Tail (last item) of dictionary\n"); - printf("? :: Print this message\n"); - printf("q :: Quit\n\n"); - printf(" is "); + printf("\nUsage: \nType a single character, followed by an optional key as follows:\n\n"); + printf(" i :: Insert into dictionary\n"); + printf(" d :: Delete from dictionary\n"); + printf(" f :: Find in dictionary\n"); + printf(" n :: Next of local current item in dictionary\n"); + printf(" p :: Previous of local current item in dictionary\n"); + printf(" h :: Head (first item) of dictionary\n"); + printf(" t :: Tail (last item) of dictionary\n"); + printf(" ? :: Print this message\n"); + printf(" q :: Quit\n\n"); + printf("where is \n"); } /*************************************************************************/ @@ -87,10 +100,12 @@ TestLoop( Dictionary * pdict ) Record r, currRecord; Record *pcurrRecord = &currRecord; + Record * pnew; Record *pr = &r; Record * pNullRecord = NULL; Dict_Status status; + void * pitem; short i; // Dictionary * pdict = *pvd; @@ -105,7 +120,7 @@ TestLoop( Dictionary * pdict ) while ( op != 'q' ) { - printf("\nnext op (i d x f n N p P h t ? q): "); + printf("\nnext op (i d x f n p h t ? q): "); gets(buffer); op = buffer[0]; @@ -206,7 +221,7 @@ TestLoop( Dictionary * pdict ) // Delete if (pdict != NULL) { - status = Dict_Delete(pdict, (void **)&pr); + status = Dict_Delete(pdict, (void **)&pr); freeRecord(pr); pr = &r; } @@ -217,7 +232,7 @@ TestLoop( Dictionary * pdict ) if ((pdict != NULL) && (pdict->root != NULL)) { pr = DICT_CURR_ITEM(pdict); - status = Dict_Delete(pdict, (void **) &pr); + status = Dict_Delete(pdict, (void **) &pr); freeRecord(pr); pr = &r; } @@ -229,7 +244,7 @@ TestLoop( Dictionary * pdict ) /* while (pdict->root != NULL) { pr = DICT_CURR_ITEM(pdict); - status = Dict_Delete(pdict, (void **)&pr); + status = Dict_Delete(pdict, (void **)&pr); freeRecord(pr); pr = &r; } @@ -265,23 +280,19 @@ Init_dict(Dictionary * dp) { Record* rp; - printf ("in Init_dict\n"); - -/* -*/ - rp = makeRecord(0, "jack_smith"); Dict_Insert(dp, rp); - rp = makeRecord(0, "john_doe"); Dict_Insert(dp, rp); - rp = makeRecord(1, "jean_doe"); Dict_Insert(dp, rp); - rp = makeRecord(0, "joana_smith"); Dict_Insert(dp, rp); - rp = makeRecord(1, "michael_jones"); Dict_Insert(dp, rp); - rp = makeRecord(0, "mike_jacobs"); Dict_Insert(dp, rp); - rp = makeRecord(2, "bill_jackson"); Dict_Insert(dp, rp); - rp = makeRecord(0, "jane_doe"); Dict_Insert(dp, rp); - rp = makeRecord(0, "dianne_jackson"); Dict_Insert(dp, rp); - rp = makeRecord(1, "james_doe"); Dict_Insert(dp, rp); - rp = makeRecord(1, "steve_johnson"); Dict_Insert(dp, rp); - rp = makeRecord(2, "debbie_jones"); Dict_Insert(dp, rp); - rp = makeRecord(0, "jacob_jacobson"); Dict_Insert(dp, rp); + rp = makeRecord((short)0, "jack_smith"); Dict_Insert(dp, rp); + rp = makeRecord((short)0, "john_doe"); Dict_Insert(dp, rp); + rp = makeRecord((short)1, "jean_doe"); Dict_Insert(dp, rp); + rp = makeRecord((short)0, "joana_smith"); Dict_Insert(dp, rp); + rp = makeRecord((short)1, "michael_jones"); Dict_Insert(dp, rp); + rp = makeRecord((short)0, "mike_jacobs"); Dict_Insert(dp, rp); + rp = makeRecord((short)2, "bill_jackson"); Dict_Insert(dp, rp); + rp = makeRecord((short)0, "jane_doe"); Dict_Insert(dp, rp); + rp = makeRecord((short)0, "dianne_jackson"); Dict_Insert(dp, rp); + rp = makeRecord((short)1, "james_doe"); Dict_Insert(dp, rp); + rp = makeRecord((short)1, "steve_johnson"); Dict_Insert(dp, rp); + rp = makeRecord((short)2, "debbie_jones"); Dict_Insert(dp, rp); + rp = makeRecord((short)0, "jacob_jacobson"); Dict_Insert(dp, rp); Dict_Print(dp, TAB_STOPS); } @@ -302,8 +313,8 @@ main_dict () TestLoop(pdict); } -void -main(void) +void _CRTAPI1 +main(int argc, char *argv[]) { main_dict (); }