ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

echo.c
Go to the documentation of this file.
00001 /*
00002  *  ECHO.C - internal echo commands.
00003  *
00004  *
00005  *  History:
00006  *
00007  *    16 Jul 1998 (Hans B Pufal)
00008  *        Started.
00009  *
00010  *    16 Jul 1998 (John P Price)
00011  *        Separated commands into individual files.
00012  *
00013  *    27-Jul-1998 (John P Price <linux-guru@gcfl.net>)
00014  *        Added config.h include
00015  *
00016  *    08-Dec-1998 (Eric Kohl)
00017  *        Added help text ("/?").
00018  *
00019  *    19-Jan-1999 (Eric Kohl)
00020  *        Unicode and redirection ready!
00021  *
00022  *    13-Jul-2000 (Eric Kohl)
00023  *        Implemented 'echo.' and 'echoerr.'.
00024  *
00025  *    28-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
00026  *        Remove all hardcode string to En.rc
00027  */
00028 
00029 #include <precomp.h>
00030 
00031 BOOL
00032 OnOffCommand(LPTSTR param, LPBOOL flag, INT message)
00033 {
00034     TCHAR *p2;
00035     if (_tcsnicmp(param, D_OFF, sizeof(D_OFF)/sizeof(TCHAR) - 1) == 0)
00036     {
00037         p2 = param + sizeof(D_OFF)/sizeof(TCHAR) - 1;
00038         while (_istspace(*p2))
00039             p2++;
00040         if (*p2 == _T('\0'))
00041         {
00042             *flag = FALSE;
00043             return TRUE;
00044         }
00045     }
00046     else if (_tcsnicmp(param, D_ON, sizeof(D_ON)/sizeof(TCHAR) - 1) == 0)
00047     {
00048         p2 = param + sizeof(D_ON)/sizeof(TCHAR) - 1;
00049         while (_istspace(*p2))
00050             p2++;
00051         if (*p2 == _T('\0'))
00052         {
00053             *flag = TRUE;
00054             return TRUE;
00055         }
00056     }
00057     else if (*param == _T('\0'))
00058     {
00059         ConOutResPrintf(message, *flag ? D_ON : D_OFF);
00060         return TRUE;
00061     }
00062     return FALSE;
00063 }
00064 
00065 INT CommandEcho (LPTSTR param)
00066 {
00067     LPTSTR p1;
00068 
00069     TRACE ("CommandEcho: '%s'\n", debugstr_aw(param));
00070 
00071                 /* skip all spaces for the check of '/?', 'ON' and 'OFF' */
00072                 p1 = param;
00073                 while(_istspace(*p1))
00074                         p1++;
00075 
00076             if (!_tcsncmp (p1, _T("/?"), 2))
00077             {
00078                 ConOutResPaging(TRUE,STRING_ECHO_HELP4);
00079                 return 0;
00080             }
00081 
00082     if (!OnOffCommand(p1, &bEcho, STRING_ECHO_HELP5))
00083     {
00084         /* skip the first character */
00085         ConOutPuts(param + 1);
00086         ConOutPuts(_T("\n"));
00087     }
00088     return 0;
00089 }
00090 
00091 INT CommandEchos (LPTSTR param)
00092 {
00093     TRACE ("CommandEchos: '%s'\n", debugstr_aw(param));
00094 
00095     if (!_tcsncmp (param, _T("/?"), 2))
00096     {
00097         ConOutResPuts(STRING_ECHO_HELP1);
00098         return 0;
00099     }
00100 
00101     ConOutPrintf (_T("%s"), param);
00102     return 0;
00103 }
00104 
00105 
00106 INT CommandEchoerr (LPTSTR param)
00107 {
00108     TRACE ("CommandEchoerr: '%s'\n", debugstr_aw(param));
00109 
00110     if (!_tcsncmp (param, _T("/?"), 2))
00111     {
00112         ConOutResPuts(STRING_ECHO_HELP2);
00113         return 0;
00114     }
00115 
00116     ConErrPuts (param);
00117     return 0;
00118 }
00119 
00120 
00121 INT CommandEchoserr (LPTSTR param)
00122 {
00123     TRACE ("CommandEchoserr: '%s'\n", debugstr_aw(param));
00124 
00125     if (!_tcsncmp (param, _T("/?"), 2))
00126     {
00127         ConOutResPuts(STRING_ECHO_HELP3);
00128         return 0;
00129     }
00130 
00131     ConErrPrintf (_T("%s"), param);
00132     return 0;
00133 }
00134 
00135 /* EOF */

Generated on Mon May 28 2012 04:17:41 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.