![]() |
|
|||
0001 /** 0002 * @brief Remove all matched queues 0003 * 0004 * @file cmd_qrm.c 0005 */ 0006 /* ----------------------------------------------------------------------------- 0007 * Enduro/X Middleware Platform for Distributed Transaction Processing 0008 * Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved. 0009 * Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved. 0010 * This software is released under one of the following licenses: 0011 * AGPL (with Java and Go exceptions) or Mavimax's license for commercial use. 0012 * See LICENSE file for full text. 0013 * ----------------------------------------------------------------------------- 0014 * AGPL license: 0015 * 0016 * This program is free software; you can redistribute it and/or modify it under 0017 * the terms of the GNU Affero General Public License, version 3 as published 0018 * by the Free Software Foundation; 0019 * 0020 * This program is distributed in the hope that it will be useful, but WITHOUT ANY 0021 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 0022 * PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3 0023 * for more details. 0024 * 0025 * You should have received a copy of the GNU Affero General Public License along 0026 * with this program; if not, write to the Free Software Foundation, Inc., 0027 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 0028 * 0029 * ----------------------------------------------------------------------------- 0030 * A commercial use license is available from Mavimax, Ltd 0031 * contact@mavimax.com 0032 * ----------------------------------------------------------------------------- 0033 */ 0034 #include <string.h> 0035 #include <stdio.h> 0036 #include <stdlib.h> 0037 #include <memory.h> 0038 #include <sys/param.h> 0039 0040 #include <ndrstandard.h> 0041 #include <ndebug.h> 0042 0043 #include <ndrx.h> 0044 #include <ndrxdcmn.h> 0045 #include <atmi_int.h> 0046 #include <gencall.h> 0047 #include <nclopt.h> 0048 #include <sys_unix.h> 0049 #include <utlist.h> 0050 /*---------------------------Externs------------------------------------*/ 0051 /*---------------------------Macros-------------------------------------*/ 0052 /*---------------------------Enums--------------------------------------*/ 0053 /*---------------------------Typedefs-----------------------------------*/ 0054 /*---------------------------Globals------------------------------------*/ 0055 /*---------------------------Statics------------------------------------*/ 0056 /*---------------------------Prototypes---------------------------------*/ 0057 0058 /** 0059 * Remove specific q 0060 * @param p_cmd_map 0061 * @param argc 0062 * @param argv 0063 * @return SUCCEED 0064 */ 0065 expublic int cmd_qrm(cmd_mapping_t *p_cmd_map, int argc, char **argv, int *p_have_next) 0066 { 0067 int ret=EXSUCCEED; 0068 int i; 0069 string_list_t* qlist = NULL; 0070 string_list_t* elt = NULL; 0071 0072 if (argc>=2) 0073 { 0074 if (NULL!=(qlist = ndrx_sys_mqueue_list_make(ndrx_get_G_atmi_env()->qpath, &ret))) 0075 { 0076 LL_FOREACH(qlist,elt) 0077 { 0078 for (i=1; i<argc; i++) 0079 { 0080 if (0==strcmp(elt->qname, argv[i])) 0081 { 0082 printf("Removing [%s] ...", elt->qname); 0083 0084 if (EXSUCCEED==ndrx_mq_unlink(elt->qname)) 0085 { 0086 printf("SUCCEED\n"); 0087 } 0088 else 0089 { 0090 printf("FAIL\n"); 0091 } 0092 } 0093 } 0094 } 0095 } 0096 } 0097 else 0098 { 0099 EXFAIL_OUT(ret); 0100 } 0101 0102 out: 0103 0104 ndrx_string_list_free(qlist); 0105 return ret; 0106 } 0107 0108 0109 /** 0110 * Remove all queues 0111 * @param p_cmd_map 0112 * @param argc 0113 * @param argv 0114 * @return SUCCEED 0115 */ 0116 expublic int cmd_qrmall(cmd_mapping_t *p_cmd_map, int argc, char **argv, int *p_have_next) 0117 { 0118 int ret=EXSUCCEED; 0119 int i; 0120 string_list_t* qlist = NULL; 0121 string_list_t* elt = NULL; 0122 0123 if (argc>=2) 0124 { 0125 if (NULL!=(qlist = ndrx_sys_mqueue_list_make(ndrx_get_G_atmi_env()->qpath, &ret))) 0126 { 0127 LL_FOREACH(qlist,elt) 0128 { 0129 for (i=1; i<argc; i++) 0130 { 0131 if (NULL!=strstr(elt->qname, argv[i])) 0132 { 0133 printf("Removing [%s] ...", elt->qname); 0134 0135 0136 if (EXSUCCEED==ndrx_mq_unlink(elt->qname)) 0137 { 0138 printf("SUCCEED\n"); 0139 } 0140 else 0141 { 0142 printf("FAIL\n"); 0143 } 0144 } 0145 } 0146 } 0147 } 0148 } 0149 else 0150 { 0151 EXFAIL_OUT(ret); 0152 } 0153 0154 out: 0155 0156 ndrx_string_list_free(qlist); 0157 return ret; 0158 } 0159 /* vim: set ts=4 sw=4 et smartindent: */
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.1.0 LXR engine. The LXR team |
![]() ![]() |