From b5aec3ddac1ad1ad0c296eeb8e11145a53038e0b Mon Sep 17 00:00:00 2001 From: Ged Murphy Date: Thu, 29 Sep 2005 22:36:46 +0000 Subject: [PATCH] randomise the quote sent svn path=/trunk/; revision=18160 --- reactos/apps/utils/net/tcpsvcs/qotd.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/reactos/apps/utils/net/tcpsvcs/qotd.c b/reactos/apps/utils/net/tcpsvcs/qotd.c index aa4c5ba1598..931e8238c1c 100644 --- a/reactos/apps/utils/net/tcpsvcs/qotd.c +++ b/reactos/apps/utils/net/tcpsvcs/qotd.c @@ -7,13 +7,13 @@ //these need putting in an RC file. TCHAR Quotes[][MAX_QUOTE_BUF] = { - _T("\"I have a penchant for mischief, property damage, stalking and cheesecake, of course\" - kjk hyperion"), + _T("\"I have a penchant for mischief, property damage, stalking and cheesecake, of course\"\n - kjk hyperion"), _T("\"Wow! I fixed a setmenu bug.\" - jimtabor"), - _T("\"if the code is broken though, your free to call it ur own\" - Alex Ionescu"), - _T("\"i don't know about any bug; none exist; ReactOS is prefect\" - filip2307"), - _T("\"if you were kernel code, cutler would rewrite you.\" - Alex Ionescu"), - _T("\"Looks like Hartmut is cleaning out his WC. working copy, that is\" - WaxDragon") - _T("\"don't question it ... it's clearly an optimization\" - arty") + _T("\"if the code is broken though, your free to call it ur own\"\n - Alex Ionescu"), + _T("\"i don't know about any bug; none exist; ReactOS is prefect\"\n - filip2307"), + _T("\"if you were kernel code, cutler would rewrite you.\"\n - Alex Ionescu"), + _T("\"Looks like Hartmut is cleaning out his WC. working copy, that is\"\n - WaxDragon") + _T("\"don't question it ... it's clearly an optimization\"\n - arty") }; DWORD WINAPI QotdHandler(VOID* Sock_) @@ -21,11 +21,16 @@ DWORD WINAPI QotdHandler(VOID* Sock_) DWORD Retval = 0; SOCKET Sock; INT NumOfQuotes; + INT QuoteToPrint; Sock = (SOCKET)Sock_; NumOfQuotes = sizeof(Quotes) / MAX_QUOTE_BUF; - SendQuote(Sock, Quotes[1]); + /* randomise the quote */ + srand((unsigned int) time(0)); + QuoteToPrint = rand() % NumOfQuotes; + + SendQuote(Sock, Quotes[QuoteToPrint]); _tprintf(_T("Shutting connection down...\n")); if (ShutdownConnection(Sock, FALSE))