Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(136)

Side by Side Diff: xz/src/common/tuklib_progname.c

Issue 2869016: Add an unpatched version of xz, XZ Utils, to /trunk/deps/third_party (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/
Patch Set: Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « xz/src/common/tuklib_progname.h ('k') | xz/src/liblzma/Makefile.am » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 /// \file tuklib_progname.c
4 /// \brief Program name to be displayed in messages
5 //
6 // Author: Lasse Collin
7 //
8 // This file has been put into the public domain.
9 // You can do whatever you want with this file.
10 //
11 ///////////////////////////////////////////////////////////////////////////////
12
13 #include "tuklib_progname.h"
14 #include <string.h>
15
16
17 #if !HAVE_DECL_PROGRAM_INVOCATION_NAME
18 char *progname = NULL;
19 #endif
20
21
22 extern void
23 tuklib_progname_init(char **argv)
24 {
25 #ifdef TUKLIB_DOSLIKE
26 // On these systems, argv[0] always has the full path and .exe
27 // suffix even if the user just types the plain program name.
28 // We modify argv[0] to make it nicer to read.
29
30 // Strip the leading path.
31 char *p = argv[0] + strlen(argv[0]);
32 while (argv[0] < p && p[-1] != '/' && p[-1] != '\\')
33 --p;
34
35 argv[0] = p;
36
37 // Strip the .exe suffix.
38 p = strrchr(p, '.');
39 if (p != NULL)
40 *p = '\0';
41
42 // Make it lowercase.
43 for (p = argv[0]; *p != '\0'; ++p)
44 if (*p >= 'A' && *p <= 'Z')
45 *p = *p - 'A' + 'a';
46 #endif
47
48 progname = argv[0];
49 return;
50 }
OLDNEW
« no previous file with comments | « xz/src/common/tuklib_progname.h ('k') | xz/src/liblzma/Makefile.am » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698