-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a helper function for an command line application stub that calls another command line tool in the same directory and forwards all environment variables, command line parameters and standard I/O streams and returns the return code of the called tool. This can be used to easily implement forwarding stubs for deprecated tools that have been replaced by a tool that supports the same command line options.
- Loading branch information
Marco Eichelberg
committed
Sep 14, 2024
1 parent
efedf53
commit adf5472
Showing
6 changed files
with
376 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* | ||
* Copyright (C) 2024, OFFIS e.V. | ||
* All rights reserved. See COPYRIGHT file for details. | ||
* | ||
* This software and supporting documentation were developed by | ||
* | ||
* OFFIS e.V. | ||
* R&D Division Health | ||
* Escherweg 2 | ||
* D-26121 Oldenburg, Germany | ||
* | ||
* | ||
* Module: dcmimage | ||
* | ||
* Authors: Marco Eichelberg | ||
* | ||
* Purpose: Main function for a proxy stub that simply calls another | ||
* command line tool and forwards environment, command line arguments, | ||
* standard I/O streams, and return code. | ||
* | ||
*/ | ||
|
||
#ifndef OFSTUB_H | ||
#define OFSTUB_H | ||
|
||
#include "dcmtk/config/osconfig.h" /* make sure OS specific configuration is included first */ | ||
#include "dcmtk/ofstd/ofdefine.h" /* for DCMTK_OFSTD_EXPORT */ | ||
|
||
/** main function to be called in a command line stub application that | ||
* calls another command line tool located in the same directory | ||
* and forwards all command line parameters, all environment variables, | ||
* and the standard I/O stream to that command line tool. | ||
* @param argc number of command line parameters as passed to main(), must be > 0 | ||
* @param argv array of command line parameters as passed to main() | ||
* @param stubName name of the stub command line tool | ||
* @param appName name of the real command line tool to be called | ||
* @return value to be returned from main(). If the command line tool given as appName | ||
* cannot be executed, returns an error code. Otherwise, on Posix platform, this | ||
* function will never returns, as it calls execve(). The calling process will instead | ||
* receive the return code of the callled tool. On Windows, the function will wait | ||
* until the child process terminates and will then return the child process's | ||
* return code. In any case, the stub can simply return the result of this function. | ||
*/ | ||
DCMTK_OFSTD_EXPORT int OFstub_main(int argc, char** argv, const char *stubName, const char *appName); | ||
|
||
#endif // #ifndef OFSTUB_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.