tasty! apache remover is working
[feisty_meow.git] / nucleus / tools / simple_utilities / short_path.cpp
1 /*****************************************************************************\
2 *                                                                             *
3 *  Name   : short_path                                                        *
4 *  Author : Chris Koeritz                                                     *
5 *                                                                             *
6 *  Purpose:                                                                   *
7 *                                                                             *
8 *    This program converts a pathname to its 8.3 name.  Only for windows.     *
9 *                                                                             *
10 *******************************************************************************
11 * Copyright (c) 2007-$now By Author.  This program is free software; you can  *
12 * redistribute it and/or modify it under the terms of the GNU General Public  *
13 * License as published by the Free Software Foundation; either version 2 of   *
14 * the License or (at your option) any later version.  This is online at:      *
15 *     http://www.fsf.org/copyleft/gpl.html                                    *
16 * Please send any updates to: fred@gruntose.com                               *
17 \*****************************************************************************/
18
19 #include <application/windoze_helper.h>
20 #include <basis/astring.h>
21 #include <structures/static_memory_gremlin.h>
22
23 #include <stdio.h>
24 #include <string.h>
25 #ifdef __WIN32__
26   #include <windows.h>
27 #endif
28
29 using namespace basis;
30 using namespace structures;
31
32 ///HOOPLE_STARTUP_CODE;
33
34 int main(int argc, char *argv[])
35 {
36   astring shorty('\0', 2048);
37   if (argc < 2) {
38     printf("This program needs a path to convert to its short form.\n");
39     return 23;
40   }
41 #ifdef __WIN32__
42   GetShortPathNameA(argv[1], shorty.s(), 2045);
43 #else
44   strcpy(shorty.s(), argv[1]);
45 #endif
46   shorty.replace_all('\\', '/');
47   printf("%s", shorty.s());
48   return 0;
49 }
50
51 #ifdef __BUILD_STATIC_APPLICATION__
52   // static dependencies found by buildor_gen_deps.sh:
53   #include <application/windoze_helper.cpp>
54   #include <basis/astring.cpp>
55   #include <basis/common_outcomes.cpp>
56   #include <basis/environment.cpp>
57   #include <basis/guards.cpp>
58   #include <basis/mutex.cpp>
59   #include <basis/utf_conversion.cpp>
60   #include <configuration/application_configuration.cpp>
61   #include <configuration/configurator.cpp>
62   #include <configuration/ini_configurator.cpp>
63   #include <configuration/ini_parser.cpp>
64   #include <configuration/table_configurator.cpp>
65   #include <configuration/variable_tokenizer.cpp>
66   #include <filesystem/byte_filer.cpp>
67   #include <filesystem/directory.cpp>
68   #include <filesystem/filename.cpp>
69   #include <loggers/console_logger.cpp>
70   #include <loggers/program_wide_logger.cpp>
71   #include <structures/checksums.cpp>
72   #include <structures/object_packers.cpp>
73   #include <structures/static_memory_gremlin.cpp>
74   #include <structures/string_hasher.cpp>
75   #include <structures/string_table.cpp>
76   #include <structures/version_record.cpp>
77   #include <textual/parser_bits.cpp>
78   #include <timely/earth_time.cpp>
79   #include <timely/time_stamp.cpp>
80 #endif // __BUILD_STATIC_APPLICATION__
81