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

chcp.c
Go to the documentation of this file.
00001 /*
00002  *  CHCP.C - chcp internal command.
00003  *
00004  *
00005  *  History:
00006  *
00007  *    23-Dec-1998 (Eric Kohl)
00008  *        Started.
00009  *
00010  *    02-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
00011  *        Remove all hardcode string to En.rc
00012  */
00013 
00014 #include <precomp.h>
00015 
00016 
00017 
00018 #ifdef INCLUDE_CMD_CHCP
00019 
00020 INT CommandChcp (LPTSTR param)
00021 {
00022     LPTSTR *arg;
00023     INT    args;
00024     UINT uNewCodePage;
00025 
00026     /* print help */
00027     if (!_tcsncmp (param, _T("/?"), 2))
00028     {
00029         ConOutResPaging(TRUE,STRING_CHCP_HELP);
00030         return 0;
00031     }
00032 
00033     nErrorLevel = 0;
00034 
00035     /* get parameters */
00036     arg = split (param, &args, FALSE, FALSE);
00037 
00038     if (args == 0)
00039     {
00040         /* display active code page number */
00041         ConErrResPrintf(STRING_CHCP_ERROR1, InputCodePage);
00042         freep (arg);
00043         return 0;
00044     }
00045 
00046     if (args >= 2)
00047     {
00048         /* too many parameters */
00049         ConErrResPrintf(STRING_ERROR_INVALID_PARAM_FORMAT, param);
00050         nErrorLevel = 1;
00051         freep (arg);
00052         return 1;
00053     }
00054 
00055     uNewCodePage = (UINT)_ttoi(arg[0]);
00056 
00057     if (uNewCodePage == 0)
00058     {
00059         ConErrResPrintf(STRING_ERROR_INVALID_PARAM_FORMAT, arg[0]);
00060         freep (arg);
00061         nErrorLevel = 1;
00062         return 1;
00063     }
00064 
00065     if (!SetConsoleCP(uNewCodePage))
00066     {
00067         ConErrResPuts(STRING_CHCP_ERROR4);
00068     }
00069     else
00070     {
00071 
00072         SetConsoleOutputCP (uNewCodePage);
00073         InitLocale ();
00074         InputCodePage= GetConsoleCP();
00075     }
00076 
00077     freep (arg);
00078 
00079     return 0;
00080 }
00081 
00082 #endif /* INCLUDE_CMD_CHCP */

Generated on Sat May 26 2012 04:17:00 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.