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

shift.c
Go to the documentation of this file.
00001 /*
00002  *  SHIFT.C - shift internal batch command
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  *    07-Jan-1999 (Eric Kohl)
00017  *        Added help text ("shift /?") and cleaned up.
00018  *
00019  *    20-Jan-1999 (Eric Kohl)
00020  *        Unicode and redirection safe!
00021  *
00022  *    30-Apr-2005 (Magnus Olsen) <magnus@greatlord.com>)
00023  *        Remove all hardcode string to En.rc
00024  */
00025 
00026 #include <precomp.h>
00027 
00028 
00029 /*
00030  *  Perform the SHIFT command.
00031  *
00032  * Only valid inside batch files.
00033  *
00034  * FREEDOS extension : optional parameter DOWN to allow shifting
00035  *   parameters backwards.
00036  *
00037  */
00038 
00039 INT cmd_shift (LPTSTR param)
00040 {
00041     INT i = 0;
00042     TRACE ("cmd_shift: (\'%s\')\n", debugstr_aw(param));
00043 
00044     if (!_tcsncmp (param, _T("/?"), 2))
00045     {
00046         ConOutResPaging(TRUE,STRING_SHIFT_HELP);
00047         return 0;
00048     }
00049 
00050     nErrorLevel = 0;
00051 
00052     if (bc == NULL)
00053     {
00054         /* not in batch - error!! */
00055         nErrorLevel = 1;
00056         return 1;
00057     }
00058 
00059     if (!_tcsicmp (param, _T("down")))
00060     {
00061         if (bc->shiftlevel[0])
00062             for (; i <= 9; i++)
00063                 bc->shiftlevel[i]--;
00064     }
00065     else /* shift up */
00066     {
00067         if (*param == _T('/'))
00068         {
00069             if (param[1] < '0' || param[1] > '9')
00070             {
00071                 error_invalid_switch(param[1]);
00072                 return 1;
00073             }
00074             i = param[1] - '0';
00075         }
00076 
00077         for (; i < 9; i++)
00078             bc->shiftlevel[i] = bc->shiftlevel[i + 1];
00079         bc->shiftlevel[i]++;
00080     }
00081 
00082     return 0;
00083 }
00084 
00085 /* EOF */

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