xaizek / vifm (License: GPLv2+) (since 2018-12-07)
Vifm is a file manager with curses interface, which provides Vi[m]-like environment for managing objects within file systems, extended with some useful ideas from mutt.
Commit 95fda4671fd3da99232ee6059dc5b83999cdd67c

Add get_pid() utility function
It gets identification of the current process in a portable way.
Author: xaizek
Author date (UTC): 2013-01-06 16:57
Committer name: xaizek
Committer date (UTC): 2013-01-06 16:57
Parent(s): bcda984e9cf7c8e7cc87879072d44b9e83bd06bc
Signing key:
Tree: 9cad7d37778b6370f577925072ba53a91b5b3d9b
File Lines added Lines deleted
src/utils/utils.c 14 4
src/utils/utils.h 3 1
File src/utils/utils.c changed (mode: 100644) (index 676a636f3..c8a996dae)
... ... enclose_in_dquotes(const char *str)
406 406 } }
407 407
408 408 const char * const char *
409 make_name_unique(const char *filename)
409 make_name_unique(const char filename[])
410 410 { {
411 411 static char unique[PATH_MAX]; static char unique[PATH_MAX];
412 412 size_t len; size_t len;
 
... ... make_name_unique(const char *filename)
414 414
415 415 #ifndef _WIN32 #ifndef _WIN32
416 416 len = snprintf(unique, sizeof(unique), "%s_%u%u_00", filename, getppid(), len = snprintf(unique, sizeof(unique), "%s_%u%u_00", filename, getppid(),
417 getpid());
417 get_pid());
418 418 #else #else
419 /* TODO: fix name uniqualization on Windows */
420 len = snprintf(unique, sizeof(unique), "%s_%u%u_00", filename, 0, 0);
419 /* TODO: think about better name uniqualization on Windows. */
420 len = snprintf(unique, sizeof(unique), "%s_%u_00", filename, get_pid());
421 421 #endif #endif
422 422 i = 0; i = 0;
423 423
 
... ... make_name_unique(const char *filename)
428 428 return unique; return unique;
429 429 } }
430 430
431 unsigned int
432 get_pid(void)
433 {
434 #ifndef _WIN32
435 return getpid();
436 #else
437 return GetCurrentProcessId();
438 #endif
439 }
440
431 441 char * char *
432 442 get_command_name(const char line[], int raw, size_t buf_len, char buf[]) get_command_name(const char line[], int raw, size_t buf_len, char buf[])
433 443 { {
File src/utils/utils.h changed (mode: 100644) (index 4da208e35..2aaa8f0fe)
... ... const char * enclose_in_dquotes(const char *str);
70 70 int my_chdir(const char *path); int my_chdir(const char *path);
71 71 /* Makes filename unique by adding an unique suffix to it. /* Makes filename unique by adding an unique suffix to it.
72 72 * Returns pointer to a statically allocated buffer */ * Returns pointer to a statically allocated buffer */
73 const char * make_name_unique(const char *filename);
73 const char * make_name_unique(const char filename[]);
74 /* Returns process identification in a portable way. */
75 unsigned int get_pid(void);
74 76 /* Finds command name in the command line and writes it to the buf. /* Finds command name in the command line and writes it to the buf.
75 77 * Raw mode will preserve quotes on Windows. * Raw mode will preserve quotes on Windows.
76 78 * Returns a pointer to the argument list. */ * Returns a pointer to the argument list. */
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/vifm

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/vifm

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master